lsqcurvefit to fit data- changes with number of data points?
1 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a weird problem. I am using lsqcurvefit as shown below. I wanted to see if removing the first few points changed the fit. Since what I am looking for isn't in that time frequency period anyways (x-axis). It seems that if I cut off 4-5 data points before fitting, my algorithm comes back with a completely different (and very visibly wrong) answer.
All data points (blue) with fit in red:
After just removing points smaller than 10^-6 I get this:
My code is below
[parameters, resnorm, residual] = ...
lsqcurvefit(@SCD, param, ...
time, autocorrelation, lowerbounds, upperbounds, options);
SCD is then function
function gD = scd(param,time)
gD = (gamma2./param(1)).*...
(1 + 8*param(2).*time./(wo.^2)).^(-1).*...
(1 + 8*param(2).*time./(z.^2)).^(-1/2) +...
param(3);
Any help with why this is, or how to get a better fit is greatly appreciated! Thank you!
2 个评论
John D'Errico
2014-2-26
编辑:John D'Errico
2014-2-26
In any case, the model fits the data poorly, and it will still do so even if you could get consistent convergence. Do you REALLY believe this model fits the data, or are you just trying to stuff some data into the only model you could think of?
回答(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!