mardi 20 novembre 2018

Generating random numbers using randn in MATLAB

I am using randn in MATLAB to generate a set of random numbers for a given mean and standard deviation.

b=5000;
a=500;
y = a.*randn(100,1) + b;
sprintf('%f\n',y)

I expect that numbers generated would lie between 4500 to 5500. But, I see values in the range of 3000 to 6000.

Could someone explain why this happens?

Or is there any way to specify that the values should lie between mean plus/ minus 1 SD ?




Aucun commentaire:

Enregistrer un commentaire