random exponential cdf numbers

18 views (last 30 days)
evan lan
evan lan on 18 Jun 2012
How could I generate random results from an exponential cumulative distribution function?
Thanks, in advance!

Accepted Answer

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

Sign in to comment.

More Answers (0)

Categories

Find more on Random Number Generation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!