Use 'trandn' function to draw random numbers from a lognormal distribution
Show older comments
Hi,
Is it possible to use the function 'trandn' to draw random number from a lognormal distribution?
For example:
mu=2;
sigma=1;
upper_bound=10;
Thanks
Answers (1)
Jeff Miller
on 27 May 2020
0 votes
An easy way to get random numbers from a lognormal distribution is to get random numbers from a normal distribution and then exponentiate them. So you could use trand to generate truncated normals (rn) and then form rln = exp(rn).
1 Comment
Shlomit Sharoni
on 27 May 2020
Categories
Find more on Random Number Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!