Create sample for normal dsitribution

I want to create a sample from normal distribution (mean and SD) curve. How can i do that?

For example, I have a mean of 2 and SD of 0.1. I want to create 30 samples (such as, 1.92, 1.98, 2.04......).

1 Answer


You can use the rndn function to draw random samples from a Normal distribution with mean=0 and standard=1. You can change the mean and standard deviation like this:

mu = 2;
sd = 0.1;
X = mu + (rndn(1e5, 1) .* sd);

print "mean of X = " meanc(X);
print "sd of X = " stdsc(X);

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy