Initial guess does not change in MATLAB fitting tool
7 次查看(过去 30 天)
显示 更早的评论
I am trying to fit a simple gaussian from very few raw data (a set of x points and y points) with the curve fitting tool implemented in MATLAB (i.e. the simple curve f(x) = a1*exp(-((x-b1)/c1)^2)). It uses the default non linear least squares method.
Now, I want to keep the coefficient c1 fixed, while I let the coefficients a1 and b1 moving, so I can find a good guess for height and centroid. The problem is, whichever algorithm I apply, the coefficient b1 does not move at all from its initial start point, regardless of which point it is! For example, look at the data: evidently, the centroid should go ultimately between x=3.95 and x=4. However, if I put the start point at, for example, 4.1, it will not move from there, and the fitted curve will be evidently wrong.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/547548/image.png)
Even if I put a realistic starting point for b1, for example 3.96, still it will not move. The fit will be more realistic, but I still the algorithm will not have worked properly, since it appears that it does not search at all which should be the final best guess for b1.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/547553/image.png)
Any ideas? Thank you in advance!
1 个评论
Alex Sha
2021-3-13
It is because the optimizations algorithms applied in Matlb curve-fitting tool are all local optimization algoritjms, not global optimization algorithms, therefore, the task of guessing the initial start-value is unavoidable, and the reasonable initial value depends on your experience and luck.
采纳的回答
Matt J
2021-3-13
编辑:Matt J
2021-3-13
The order of magnitude of your Y-Data is (~1e-5) is close to the default TolFun stopping parameter. This makes the algorithm prone to early stopping. Try scaling the Y-Data to be ~1e0.
0 个评论
更多回答(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!