fitting the double exponential decay curve to data and finding paprameters
조회 수: 110 (최근 30일)
이전 댓글 표시
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
채택된 답변
Ameer Hamza
2018년 5월 18일
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
Ameer Hamza
2018년 6월 7일
There is no simple answer to the question of the best initial guess. Here are few resources to which you can refer:
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!