how to create an array of size (x by y ) of normally distributed numbers having a range [a , b]

1 回表示 (過去 30 日間)
x = randi(20,5,7)
This randi func is used for uniformly distributed numbers. And for normally distributed numbers randn should be used.
But the randn func only takes the dimensions of the array which we want to create. I am a beginner. So I am stuck in the very basics.
Also I do not have mean and standard deviation values.

採用された回答

David Hill
David Hill 2020 年 4 月 12 日
If you have the mean and standard deviation, then:
sd = 5;
mu = 500;
X = sd.*randn([x,y]) + mu;

その他の回答 (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