MATLAB: How does the matlab curve fitting tool find its starting points

curve fittingCurve Fitting Toolbox

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.

Best 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 = [];