random exponential cdf numbers

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

 採用された回答

bym
bym 2012 年 6 月 18 日

0 投票

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 件)

カテゴリ

ヘルプ センター および File ExchangeRandom Number Generation についてさらに検索

質問済み:

2012 年 6 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by