Please please help,

18 ビュー (過去 30 日間)
Manu Young
Manu Young 2011 年 6 月 26 日
The question is toWrite a MATLAB script to do the following a. Create 10000 random variables uniformly distributed between 2 and 4. b. Create a histogram to approximate the actual probability density function. c. Superimpose the actual probability density function to the above histogram
This is what I have gotten so far
a=2; b=4; n=10000; r = a + (b-a).*rand(n,1);
xlabel('index');ylabel('Amplitude');grid pause X=1:10 y = unifpdf(X,2,4); hist(r,10) got stocked
Thank you so much
  3 件のコメント
Walter Roberson
Walter Roberson 2011 年 6 月 26 日
duplicate post is at http://www.mathworks.com/matlabcentral/answers/10238-probability-tossing-a-fair-pair-of-dice
Jan
Jan 2011 年 6 月 26 日
And see: http://www.mathworks.com/matlabcentral/answers/10316-help-please-please-i-am-stuck

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

採用された回答

Walter Roberson
Walter Roberson 2011 年 6 月 26 日
Please do not open duplicate questions: it just results in duplicate effort.

その他の回答 (1 件)

Paulo Silva
Paulo Silva 2011 年 6 月 26 日
a=2; b=4; n=10000; r = a + (b-a).*rand(n,1);
xlabel('index');
ylabel('Amplitude');
grid
%pause
X=1:10;
y = unifpdf(X,2,4);
[nh,xout]=hist(r,10);
hold on
plot(X,y,'r')
bar(xout,nh/n)
legend('unifpdf','hist')
  1 件のコメント
Manu Young
Manu Young 2011 年 6 月 26 日
Thank you so much

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

Community Treasure Hunt

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

Start Hunting!

Translated by