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 CenterFile Exchange에서 Random Number Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by