fitting the double exponential decay curve to data and finding paprameters
78 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Parul Tewatia
il 18 Mag 2018
Commentato: Ameer Hamza
il 7 Giu 2018
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 Commenti
Risposta accettata
Ameer Hamza
il 18 Mag 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 Commenti
Ameer Hamza
il 7 Giu 2018
There is no simple answer to the question of the best initial guess. Here are few resources to which you can refer:
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Get Started with Curve Fitting Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!