fitting the double exponential decay curve to data and finding paprameters
79 views (last 30 days)
Show older comments
I have extracted data from a florescence decay graph. the equation used has two double exponential parameters and other 2 parameters. the equation is in the matlab code. Now I want to fit the curve to this given equation so i have all the parameters. As the flouresnce data was in percentage i converted it to quantities by multiplying by 6. I worked on an example by matlab https://se.mathworks.com/help/optim/examples/nonlinear-data-fitting.html but I am not able to plot the fitting with the fplot command something is going wrong as it gives an error. Also I dont want local minima but global minima, but i am novice so dont know how to use this fitvector. But most importantly the problem i am facing is with initial parameter guess. what is a good way to find these guesses. Also I read somewhere its a good approach to divide problem into two, as the decay is quite fast initially but is quiet linear after some time. Reading too much stuff i am quite confused. I have attached both my code and data plot. thanks for the help. much appreciated Parul
0 Comments
Accepted Answer
Ameer Hamza
on 18 May 2018
Since you are trying curve fitting by minimizing least square error, lsqcurvefit() is a better choice. Try the following
t = xdata;
y = ydata;
F = @(x,xdata)x(1)*exp(-x(2)*xdata) + x(3)*exp(-x(4)*xdata);
x0 = [300 0.005 1 0] ;
xunc = lsqcurvefit(F, x0, t, y);
tlist = linspace(min(t), max(t)); % Plot Finer Resolution
figure(1)
plot(t,y,'ro')
title('Data points')
hold on
plot(tlist, F(xunc,tlist), '-r', 'LineWidth', 2)
hold off
In your code, you were also specifying the wrong first variable for function F in plot statement. The fit seems quite well.
2 Comments
Ameer Hamza
on 7 Jun 2018
There is no simple answer to the question of the best initial guess. Here are few resources to which you can refer:
More Answers (0)
See Also
Categories
Find more on Get Started with Curve Fitting Toolbox 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!