Regarding matlab syntax for probability density function
이전 댓글 표시
Hi i am new to matlab. So I would like to know how i can implement the probability density function which is uniformly distributed between a range [a,b] in matlab.
Please help me....
댓글 수: 1
dpb
2014년 4월 29일
If have Stat Toolbox
doc pdf
답변 (1개)
Star Strider
2014년 4월 29일
If you want uniformly-distributed random numbers on the interval [a b], this works:
a = 1.5;
b = 3.0;
u = (b-a)*rand(100,1)+a;
% View the result
figure(1)
hist(u)
axis([0 5 ylim])
It produces a column vector 100 uniformly-distributed random numbers on the interval [a b]. The hist function plots them so you can see the result.
The mathematical properties of the uniform distribution are straightforward. Wikipedia has all the details in its article on Uniform distribution (continuous).
카테고리
도움말 센터 및 File Exchange에서 Uniform Distribution (Continuous)에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!