Initial guess does not change in MATLAB fitting tool

8 visualizaciones (últimos 30 días)
Antonello Zito
Antonello Zito el 12 de Mzo. de 2021
Editada: Matt J el 13 de Mzo. de 2021
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 comentario
Alex Sha
Alex Sha el 13 de Mzo. de 2021
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.

Iniciar sesión para comentar.

Respuesta aceptada

Matt J
Matt J el 13 de Mzo. de 2021
Editada: Matt J el 13 de Mzo. de 2021
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.

Más respuestas (0)

Categorías

Más información sobre Get Started with Curve Fitting Toolbox en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by