plotting of mean function of exponential random variables

1 回表示 (過去 30 日間)
Mahabba Almheiri
Mahabba Almheiri 2020 年 5 月 3 日
コメント済み: Mahabba Almheiri 2020 年 5 月 7 日
I faced difficulties in implemntation the mean value
I want to get value less than or equal 1 in y-axis because its represents the probability while at the same time I need the mean to be 175 in x-axis
when I use hist command I got the correct y-axis values while x-axis is wrong
but when I use histogram command instead of hist I got the mean which is in x-axis correct while y-axis values exceed the 1.
so what command should I use ?
x=exprnd(175,50,500)
figure (1)
histogram(x)
figure (2)
x_bar=mean(x)
pdfx_bar= hist(x_bar,100)/500
stairs(pdfx_bar)

回答 (1 件)

Tommy
Tommy 2020 年 5 月 3 日
編集済み: Tommy 2020 年 5 月 3 日
The plot created by histogram has count on the y axis by default. If you would like the y axis to instead give probability, you can specify the 'Normalization' property to 'probability' for bar heights adding to 1:
x=exprnd(175,50,500);
histogram(x, 'normalization', 'probability')
or to 'pdf' for bar areas adding to 1:
x=exprnd(175,50,500);
histogram(x, 'normalization', 'pdf')
  1 件のコメント
Mahabba Almheiri
Mahabba Almheiri 2020 年 5 月 7 日
Thank you so much that help me to solve the problem

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeHistograms についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by