random exponential cdf numbers

14 次查看(过去 30 天)
How could I generate random results from an exponential cumulative distribution function?
Thanks, in advance!

采纳的回答

bym
bym 2012-6-18
mu = 2 % mean of distribution
x = -mu*log(1-rand(1,10)); % ten numbers
  2 个评论
evan lan
evan lan 2012-6-21
I thought it was the reverse type
mu = 2 % mean of distribution
p=1-exp(-rand(1,10)/mu);
Am I wrong?
bym
bym 2012-6-21
Well, yes you are. Please see http://en.wikipedia.org/wiki/Inverse_transform_sampling

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile 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