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

4 次查看(过去 30 天)
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.

采纳的回答

Ameer Hamza
Ameer Hamza 2020-12-1
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;

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by