Hello,

I need a 100 numbers of distribution for a specified mean & std. I found one, but its not accurate. The one I found is below-

sig_R_lrs=18.37e3;

mu_R_lrs=16.49e3;

sig_G_lrs=1/sig_R_lrs;

mu_G_lrs=1/mu_R_lrs;

y_lrs=sig_G_lrs.*randn(100,1)+mu_G_lrs;

here mean(y_lrs) or std(y_lrs) is not accurate. Also came across r = normrnd(16.49e3,18.37e3,[1,100]), but even here i don't get an exact mean & std :(

Any suggestion of getting an accurate mean & std and determining the distribution ?

thanks in advance :)

Answer by Image Analyst
on 17 May 2018

Sign in to comment.

Answer by Jeff Miller
on 18 May 2018

As others have said, you should not expect the randomly sampled values to match the true mean and sd exactly, due to random sampling error. If you do want to construct an artificial sample where the values do match exactly (even though this is not a true random sample), you can do so like this:

sig_R_lrs=18.37e3;

mu_R_lrs=16.49e3;

sig_G_lrs=1/sig_R_lrs;

mu_G_lrs=1/mu_R_lrs;

r = randn(100,1);

rsd = std(r);

r2=r/rsd*sig_G_lrs;

y_lrs=r2 + (mu_G_lrs-mean(r2));

Sign in to comment.

Answer by Charanraj
on 18 May 2018

Thank you all for your answers. Finally, I managed to tune something near to the desired mean & std. Yes, I was looking for the precise mean & std & I understood from your replies that although ideally speaking it is 'yes', there are some statistical errors during distribution.

Thank you all once again !

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 3 Comments

## dpb (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/401196-need-to-find-the-distribution-from-mean-standard-deviation#comment_568926

## Stephen Cobeldick (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/401196-need-to-find-the-distribution-from-mean-standard-deviation#comment_568930

## dpb (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/401196-need-to-find-the-distribution-from-mean-standard-deviation#comment_569051

Sign in to comment.