필터 지우기
필터 지우기

how to fit exponential distribution function on data?

조회 수: 10 (최근 30일)
Mos_bad
Mos_bad 2020년 1월 25일
답변: Image Analyst 2020년 1월 26일
The vector m follows the truncated exponential equation (F_M) and it is shown by solid black line in figure. I intend to fit an exponential distribution function to data and find the parameter lambda (1/mean). Even though I've used fitdist(x,distname), the fitted exp. dist. shown in dashed line which is way different from the data. here is the code:
M_min=4.5; M_max=8.0;
m=M_min:0.0001:M_max;
a=4.56; b=1.0;
alpha=a*log(10);beta=b*log(10);
nu=exp(alpha-beta*M_min);
F_M=(1-exp(-beta*(m-M_min))) / (1-(exp(-beta*(M_max-M_min)))); % CDF of Mag.
pd = fitdist(m','Exponential');
figure(1); plot(m,1-F_M,'-','linewidth',2);
hold on; plot(m,1-cdf(pd,m),'--');
legend('data','fitted dist')
  댓글 수: 2
Walter Roberson
Walter Roberson 2020년 1월 25일
a and b are not defined in the third line.
Mos_bad
Mos_bad 2020년 1월 25일
just editted. thanks for pointing that out.

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

답변 (2개)

Walter Roberson
Walter Roberson 2020년 1월 26일
You do not have an exponential distribution. (1 minus an exponential) is not an exponential.
On the other hand if you fit using the equation
a*exp(-b*x)+c
instead of
a*exp(-b*x)
then you get pretty much a perfect fit.
  댓글 수: 1
Mos_bad
Mos_bad 2020년 1월 26일
All I want to do is to devide vertical axis to 1000 intervals and pick a random value of magnitude (horizental axis) at each interval. Kind of Latin hypercube sampling.

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


Image Analyst
Image Analyst 2020년 1월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by