Generate random number from a two-parameter exponential distribution

17 ビュー (過去 30 日間)
Alexis Stevenson
Alexis Stevenson 2019 年 3 月 21 日
編集済み: Alexis Stevenson 2019 年 3 月 21 日
Hello everybody,
I am looking for a way to easily generate random numbers from a two-parameter exponential distribution. The probability density function is: . I am aware of expand() but it does not seem to include the two-parameter distribution.
Do you have any idea how I could achieve that?
Thank you very much.
Alexis
  4 件のコメント
Torsten
Torsten 2019 年 3 月 21 日
What is the support of f ?
I ask because if support(f) = IR+, f is only a probability density function if gamma = 0.
Alexis Stevenson
Alexis Stevenson 2019 年 3 月 21 日

サインインしてコメントする。

採用された回答

Torsten
Torsten 2019 年 3 月 21 日
gam = ...;
lambda = ...;
n = 100;
x = gam - log(1-rand(n,1))/lambda
give you 100 random numbers distributed according to your two-parameter distribution.
  1 件のコメント
Alexis Stevenson
Alexis Stevenson 2019 年 3 月 21 日
編集済み: Alexis Stevenson 2019 年 3 月 21 日
Oh yes thank you so much !
I just realized the cdf was and I had to invert it.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by