Initial guess does not change in MATLAB fitting tool
8 ビュー (過去 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.
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.
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!