MATLAB: Curve fitting: Difference fit, nlinfit, fitlnm

curve fittingregression

Hi,
does anyone know about the differences between commands 'fit', 'nlinfit' and 'fitlnm' for conducting nonlinear regression analysis? Can't really find anything in the documentation.
Thank you
Vince

Best Answer

The differences are simple. These tools mainly come from different toolboxes. That is really the main difference. Curve fitting is such a common problem that it is solved by many tools. You can solve any given problem with any tool. In fact, there are other tools, such as lsqnonlin or lsqcurvefit (optimization TB).
But suppose you own one of those toolboxes doing stats, optimization, or curvefitting. You would expect ANY of those toolboxes to offer this capability, and they do! Of course, they do other things too.
There are differences in the interfaces, mainly because they were all written by different people. So you might prefer one tool over another. Other reasons to prefer one over another is some allow bounds on the variables, some allow weights for the data points, some allow robust fitting, etc.
The point is, if you have two different tools that compute a minimum sum of squares of residuals for a given model, as long as both of them have converged, you really don't care which one you used.