how I write independent random numbers from a normal distribution, for example between (0,1)?
Show older comments
How I write independent random numbers from a normal distribution, for example between (0,1)? And how I can put this numbers in a matrix. Thank you.
Accepted Answer
More Answers (1)
Walter Roberson
on 8 Oct 2016
1 vote
If you restrict values drawn from a Normal distribution to any particular range (such as 0 to 1), then the values will no longer be normally distributed. It is impossible for anything to be Normally distributed unless it has infinite tails in both direction. MATLAB's randn() can produce values from -realmax to +realmax which is not truly infinite but the probability lost is tiny. Restricting to (0, 1) would be a significant probability loss and a major distortion of the normal distribution.
If you need non-uniform random numbers that must be within a particular finite range, then you should be considering using the Beta distribution; https://www.mathworks.com/help/stats/beta-distribution-1.html and http://www.mathworks.com/help/stats/betapdf.html
Categories
Find more on Random Number Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!