Calculating the error on a non-linear least squares fit
4 次查看(过去 30 天)
显示 更早的评论
Hi, so I'm currently running a program which fits some noisy data to a monoexponential function using a non-linear least squares fit. I know that the equation can be linearized by taking a logarithm, but since the data is noisy and the curve decays to zero I've found that a non-linear least squares fits the best (to avoid taking the logarithm of very small and/or negative values). Here is my fitting code:
s = fitoptions('Method','NonlinearLeastSquares',...
'Lower',[0.00001,1E-3],...
'Upper',[100,1],...
'Startpoint',[0.8 1/40]);
f = fittype('a*exp(-x*b)','options',s);
fitresults = fit(t',S',f);
ci = confint(fitresults,0.6827);
R2Values(counterTE,counterTR) = fitresults.b;
R2Error(counterTE,counterTR) = (ci(2,2)-ci(1,2))/2;
I believe this is right and I get reasonable values for both R2 (relaxation rate) and the error on it. But what I am curious is how exactly matlab calculates the error on the fit parameters. This is quite important for my particular application because I'm interested in the noise properties. If possible I was wondering if anyone knew the equation matlab used to calculate the error (intuitively I feel like it must use the residual), so that I could actually calculate the error myself. Thanks very much in advance!
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Model Identification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!