Fitting steep exponential decay curves
3 views (last 30 days)
Show older comments
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 Comments
Star Strider
on 23 Jan 2015
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.)
Accepted Answer
Star Strider
on 23 Jan 2015
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 Comments
More Answers (0)
See Also
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!