Is fit() not supposed to be used? It seems intentionally terrible.

4 views (last 30 days)
I have been trying to use fit() to fit my data, but it seems like the documentation and functionality of it are terrible.
for example, I cannot find the exitflag meanings for fit() because I donbt know what solver it's using.
I have to give column vectors, if i give row vectors it just doesn't work. (this is by far the least of my concerns)
if i just rescale everything, the fit breaks by saying my initial point is a solution, it's clearly not!
Are the options like Tolfun and Tolx relative or absolute WHO KNOWS! I assume so, because that seems like the obvious default choice, but idk
perhaps most importantly, are DiffMaxChange and DiffMinChange relative?! WHO KNOWS! (apparently not!)
if these things were documented then they wouldn't be so problematic, but they aren't, not where i could find them (well the error messsage helped me fix the column input thing, so thats just a casual gripe, but the other stuff is way more important)
The upshot is the fit() seems so poorly explained that it boggles my mind that people would use it.

Answers (1)

Walter Roberson
Walter Roberson on 9 Jun 2022
Data to fit, specified as a matrix with either one (curve fitting) or two (surface fitting) columns
  4 Comments
Walter Roberson
Walter Roberson on 10 Jun 2022
for example, I cannot find the exitflag meanings for fit() because I donbt know what solver it's using.
nonlinear custom and "library" call cflsqcurvefit() and then cfrobnlinfit() if robust was requested.
linear custom and linear library call cflsqlin() for bounded version or \ (mldivide) for no bounds, and always assign exit flag of 1. However, if robust linear fit was requested, then exit flag 1 means convergence, exit flag 0 means no convergence, and exit flag -1 means interruption.
cubicspline and smoothing spline call spline routines and always assign exit flag of 1
'interpolant' call internal routines that always return exit flag 1
lowess uses curvefit.LowessFit and always assigns exit flag of 1
The functions cflsqcurvefit(), cfrobnlinfit(), cflsqlin() are all undocumented internal functions

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!