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

2 visualizzazioni (ultimi 30 giorni)
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 Commento
Jeff Miller
Jeff Miller il 28 Giu 2019
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?

Accedi per commentare.

Risposte (1)

John D'Errico
John D'Errico il 27 Giu 2019
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