Generate random number from a two-parameter exponential distribution

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

Your function f does not depend on t ?
Sorry typo :) Thank you for noticing it.
What is the support of f ?
I ask because if support(f) = IR+, f is only a probability density function if gamma = 0.

댓글을 달려면 로그인하십시오.

 채택된 답변

Torsten
Torsten 2019년 3월 21일

0 개 추천

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

Oh yes thank you so much !
I just realized the cdf was and I had to invert it.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

질문:

2019년 3월 21일

편집:

2019년 3월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by