How to generate random numbers in a Gaussian distribution?
Ältere Kommentare anzeigen
Given A = 1 and B = 5, and knowing that the mean is 2.5 and the standard deviation is 1, I want to generate 1000 random points between A and B using a normal (Gaussian) distribution. I am unsure how to do this in MATLAB efficienctly.
6 Kommentare
John D'Errico
am 7 Feb. 2023
They are not normally distributed if they are bounded as you want. You COULD use a truncated normal distribution however.
help truncate
Ali Almakhmari
am 7 Feb. 2023
Bearbeitet: Ali Almakhmari
am 7 Feb. 2023
Voss
am 7 Feb. 2023
If they are not bounded, you can use randn:
Ali Almakhmari
am 7 Feb. 2023
Bearbeitet: Ali Almakhmari
am 7 Feb. 2023
Walter Roberson
am 7 Feb. 2023
values = mean + randn(1000,1) * sigma;
The repmat() is valid, but slower than needed for this purpose.
Ali Almakhmari
am 7 Feb. 2023
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Random Number Generation finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!