generate about 100 random number between 3 to 200 with lognormal disrtibution
1 次查看(过去 30 天)
显示 更早的评论
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
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
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.
1 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!