How does the matlab curve fitting tool find its starting points?

I would like to use a script generated out of the curve fitting tool. But the start points are hard coded into the script and every time I fit a slightly different dataset (with the gui) the starting points change and the result changes.
I would like to be able to adapt the starting points by an algorithm in the skript, like the tool/gui does it.
I am fitting data (3 to 6 datapoints) to a a*exp(b*x) function.
Thanks in advance for your help.

 Accepted Answer

You are using 'exp1' for fitting the data. For these curves, the documentation does not mention the algorithm used to find the initial point: https://www.mathworks.com/help/releases/R2020a/curvefit/fit.html#d120e27338. It just mentions that it is "chosen heuristically". If you want to use the same initialization algorithm as used by cftool, then set the startPoint to empty
opts.StartPoint = [];

3 Comments

Thank you for your answer. But I am looking actually for the way that the curve fitting tool (a matlba app) finds these start values, as they are hard coded in the script when I use the code generator in the curve fitting tool. It does not seem as the curve fitting algorithm (fit) does actual generate these points, as they are fixed in the script.
Any Idea how that happens?
Mathworks didn't disclose the algorithm used to generate that initial guess. The implementation code is protected, so we cannot inspect it too. My guess is that those parameters are not generated by cftool, rather they are generated by the fit() internally. The cftool put it in the script so that you get repeatable results. If you set StartPoint = [], then fit() will again use the same internal algorithm to generate starting point.
Of course, this is just my guess. The documentation does not have any mentions of this issue.
Ok that sounds a reasonlable guess. I will try it out. Thanks a lot!

Sign in to comment.

More Answers (0)

Categories

Products

Release

R2018b

Community Treasure Hunt

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

Start Hunting!