random exponential cdf numbers

How could I generate random results from an exponential cumulative distribution function?
Thanks, in advance!

 Respuesta aceptada

bym
bym el 18 de Jun. de 2012

0 votos

mu = 2 % mean of distribution
x = -mu*log(1-rand(1,10)); % ten numbers

2 comentarios

evan lan
evan lan el 21 de Jun. de 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 el 21 de Jun. de 2012
Well, yes you are. Please see http://en.wikipedia.org/wiki/Inverse_transform_sampling

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Random Number Generation en Centro de ayuda y File Exchange.

Preguntada:

el 18 de Jun. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by