How to generate only four normally distributed random numbers with given mean and std. deviation?
Show older comments
I am generating normally distributed random numbers using the 'randn' function for a given mean and standard deviation. Once I get the numbers, I check their mean and standard deviation, which is fairly accurate only if I am generating a large set of random numbers. I need to generate only four random numbers, and when I do that, the mean and std. deviation of these are not close to the specified mean and standard deviation. Please suggest?
Accepted Answer
More Answers (1)
Walter Roberson
on 15 Dec 2015
R = randn(1,4);
R = (R-mean(R)) /std(R) ;
R = R * Sigma + mu;
1 Comment
Kshiteej Deshmukh
on 15 Dec 2015
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!