how to generate log normal random number
Mostrar comentarios más antiguos
hi, i use this code to generate 5 random number with average 8.3 and standard deviation 2.7:
mu=8.3; %mean (m)
sigma=2.7; %standard deviation (m)
d = lognrnd(mu,sigma,5,1)
But the result:
d =
8333.6
15284
73.374
256.03
1203.6
this numbers generated, but mean of this numbers Not equal to 8.3
Where did i make mistakes?
Respuesta aceptada
Más respuestas (1)
Jeff Miller
el 20 de Jun. de 2018
Cupid has a class for a version of the lognormal where you specify the mean and sd of the scores you want. You can make an object of that class and generate random numbers from it like this:
myDist = LognormalMS(8.3,2.7);
myDist.Random(1,5)
ans =
5.2133 6.8788 8.7989 24.554 18.997
Categorías
Más información sobre Lognormal Distribution en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!