Azzera filtri
Azzera filtri

random exponential cdf numbers

1 visualizzazione (ultimi 30 giorni)
evan lan
evan lan il 18 Giu 2012
How could I generate random results from an exponential cumulative distribution function?
Thanks, in advance!

Risposta accettata

bym
bym il 18 Giu 2012
mu = 2 % mean of distribution
x = -mu*log(1-rand(1,10)); % ten numbers
  2 Commenti
evan lan
evan lan il 21 Giu 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 il 21 Giu 2012
Well, yes you are. Please see http://en.wikipedia.org/wiki/Inverse_transform_sampling

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by