Use 'trandn' function to draw random numbers from a lognormal distribution

조회 수: 6 (최근 30일)
Shlomit Sharoni
Shlomit Sharoni 2020년 5월 27일
댓글: Shlomit Sharoni 2020년 5월 27일
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

답변 (1개)

Jeff Miller
Jeff Miller 2020년 5월 27일
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
Shlomit Sharoni
Shlomit Sharoni 2020년 5월 27일
Hi,
Thanks for the reply, however, I am not sure that conduct a normal distribution, and exponent the results, is like conduct a lognormal distribution..

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by