Exponential random number generation

hi,
How to generate the exponential random numbers from uniform random number generator?
thx

 采纳的回答

lambda = 2;
x = -log(rand(1,1000000)/lambda)

4 个评论

But is there no general way, to generate any desired distributed random numbers by knowing its psd and uniform random number generator?
Theoretically, one can invert the Cumulative Distribution Function and then plug uniform random numbers into that. Inverting the CDF is not always easy to accomplish, however.
+1 to what James just wrote. If you search "generate random variate", you will find plenty to read. The book (remember those?) "Numerical Recipes" has a digestible discussion of the topic.

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Random Number Generation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by