Fitting steep exponential decay curves
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi, I am trying to fit double exponential to a steep exponential decay data.
After matching, the starting point of the fit is not matching the starting point in the data. Are there any other models that I can try to fit these type of curves? Thanks
댓글 수: 2
Star Strider
2015년 1월 23일
Without seeing at least a representative sample of your data, it’s not possible to offer any specific recommendations. (A .mat file with your x and y data is best for this.)
채택된 답변
Star Strider
2015년 1월 23일
I was able to get a decent fit with this code:
D = matfile('Karthik_exp.mat');
x = D.ans(:,1);
y = D.ans(:,2);
f1 = @(b,x) b(1) - b(2).*exp(b(3).*x);
B0 = [0; -10; -0.003];
B = nlinfit(x, y, f, B0)
f_est = f1(B, x);
figure(1)
plot(x, y)
hold on
plot(x, f_est, 'LineWidth',1)
hold off
grid
yielding these parameter estimates:
B =
-27.7275e-003
8.4539e+000
-2.5637e-003
and using this function:
f2 = @(b,x) b(1) - b(2).*exp(b(3).*x) - b(4).*exp(b(5).*x);
and appropriate changes from ‘f1’ to ‘f2’ in the same code, yielded these parameter estimates:
B =
-6.1174e-003
4.1479e+000
-9.6660e-003
5.8429e+000
-1.8677e-003
and a nearly exact fit.
The important step as always are the correct initial parameter estimates, and for this, I cheated a bit and used a linear fit on x vs log(-y) over the first 200 elements of x and y to get an initial estimate for the exponential coefficient, ‘b(3)’. After that, the model converged quickly and gave a good result.
I have the Statistics and Optimization Toolboxes, not the Curve Fitting Toolbox, but as I understand it, you can use my ‘f1’ and ‘f2’ functions with the Curve Fitting Toolbox without problems.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Interpolation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!