Exclude negative values from random number generator
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, Just a quick question.
I generate a series of normally distributed random numbers with mean 1.5 and standard deviation 0.3.
d1 = 1.5 + 0.3.*randn(100,1)
Anyone know how I can exclude all the negative results?
Thanks a lot!
Ying
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 6 Feb. 2012
d1(d1 < 0) = [];
Note that the result will not be a normal distribution and will not have mean 1.5 or standard deviation 0.3 !
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Random Number Generation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!