How can I generate a sequence of normally distrubuted random variables with a specified mean and variance?

5 views (last 30 days)
I want to generate a sequence with 10000 points of random variables with a gaussian distribution with mean 𝜇=1.5and variance 𝜎2=2.25. I'm not sure where to start or how to approach this problem.

Accepted Answer

Ameer Hamza
Ameer Hamza on 1 Dec 2020
You can use normrnd(): https://www.mathworks.com/help/stats/normrnd.html if you have Statistics and Machine Learning Toolbox.
mu = 1.5;
Var = 2.25;
x = normrnd(mu, sqrt(Var), [1 10000])
Otherwise you can also use randn()
mu = 1.5;
Var = 2.25;
x = randn(1, 10000)*sqrt(Var)+mu;

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!