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

6 views (last 30 days)
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

Ameer Hamza
Ameer Hamza on 5 May 2020
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
Ameer Hamza
Ameer Hamza on 8 May 2020
Edited: Ameer Hamza on 8 May 2020
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.
Felix Hildenbrand
Felix Hildenbrand on 8 May 2020
Ok that sounds a reasonlable guess. I will try it out. Thanks a lot!

Sign in to comment.

More Answers (0)

Categories

Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!