how to generate log normal random number
Mostra commenti meno recenti
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?
Risposta accettata
Più risposte (1)
Jeff Miller
il 20 Giu 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
Categorie
Scopri di più su Random Number Generation in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!