What is the underlying mathematical method used by fittype() to fit data to a defined formula?
1 view (last 30 days)
Show older comments
I am wondering what underling mathematical method is used by fittype() in the Curve Fitting Toolbox to fit user defined data to a user defined model? I have my code working beautifully to fit the correct model to my data, but I want to know if the fitting method itself is in line with the convention of my research field (least sum of squares fitting) or is some other mathematical curve fitting solution altogether. The documentaiton is not clear on this point.
0 Comments
Answers (1)
John D'Errico
on 31 Jan 2022
Well, fittype des not do the fitting itself. That would fall more into the regime of fit.
fittype merely allows you to specify the model. That model can be a variety of things, from a polynomial model, to a nonlinear model, to a spline interpolant, to a smoothing spline, etc. In the case of a spline interpolant, the fit is "exact", since it is an interpolant. In that case, the fitting algorithm is comepletely different. As well, in the case of a smoothing spline, the fit is now a smoothness penalized estimation. But in all the other cases, the fit is generally a simple least squares estimator. In the case of a some of the models one could choose, that fit will be what is called a linear least squares, where no starting values are necessary. A polynomial is a good example of this case.
But most models will fall into the nonlinear case. Again, this is just a simple nonlinear least squares. (You can choose between Levenberg/Marquardt or a trust region algorithm in the search.) The exeption is if you specify a robust fitting scheme to be used, but even that is probably just some form of iteratively reweighted scheme. So still the same optimization tools employed, but now with a scheme used to downweight large residual points, and then refit.
But essentially, if you are looking for the underlying mathematical method used, if the model is nonlinear, then a simple nonlinear least squares is the method. Nothing special under the hood in that respect.
See Also
Categories
Find more on Splines in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!