フィルターのクリア

Exclude negative values from random number generator

3 ビュー (過去 30 日間)
Ying
Ying 2012 年 2 月 6 日
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

採用された回答

Walter Roberson
Walter Roberson 2012 年 2 月 6 日
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 件)

カテゴリ

Help Center および File ExchangeRandom Number Generation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by