generate about 100 random number between 3 to 200 with lognormal disrtibution

조회 수: 1 (최근 30일)
Sara Shafiee
Sara Shafiee 2019년 6월 27일
댓글: Jeff Miller 2019년 6월 28일
Hi,
I want to generate about 100 random number between 3 to 200 with lognormal distribution,( mu=31.1 and sigma=0.484)
how should i do it?
  댓글 수: 1
Jeff Miller
Jeff Miller 2019년 6월 28일
I don't understand what lognormal distribution you have in mind. Here is why I am confused:
If 31.1 and 0.484 are the mean and standard deviation of the final lognormal distribution, then there is a vanishingly small probability that you will ever get any numbers outside the range of 3 to 200.
On the other hand, if 31.1 and 0.484 are the mean and standard deviation of the underlying normal (i.e., which is exponentiated to produce the lognormal), then there is a vanishingly small probability that you will ever get any numbers inside that range.
So, could you say more about what lognormal distribution you actually want to sample from? E.g., what mean would you expect? What median?

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

답변 (1개)

John D'Errico
John D'Errico 2019년 6월 27일
A lognormal distribution is not bounded. So you cannot do what you wish to do.
It is true however, that you can generate extra samples, then discard any that fall outside of your bounds. However, the result will not be lognormally distributed, because of the rejections post-sampling. But nothing stops you from using a tool like lognrnd from the stats toolbox to do the above.

Community Treasure Hunt

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

Start Hunting!

Translated by