Why does fit() not find heuristic starting points for exp1 models?
Afficher commentaires plus anciens
Hi,
I am running Matlab 2019a and I am stuck with a problem I cant quite wrap my head around. I want to use the following code to create an exponential fit based on the code CFTool creats:
%% Fit: 'untitled fit 1'.
[xData, yData] = prepareCurveData( [], test );
% Set up fittype and options.
ft = fittype( 'exp1' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.Normalize = 'on';
opts.StartPoint = [];
% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft, opts );
However, when I run it, I get the following error and it fails to fit meaningfully:
Warning: NaN, Inf, or complex value detected in startpoint;
choosing random starting point instead.
> In curvefit.attention.Warning/throw (line 30)
In fit>iFit (line 307)
In fit (line 116)
I dont understand why that happens as the documentation lists exponential models as having optimized starting points. Can someone point me to the mistake? Am I missing something? CFTool can define starting points just fine but it doesnt work in the code for some reason. Also if I switch to exp2, it works without a hitch but I need to fit a bunch of exp1 in a row and cant do it manually.
Réponses (0)
Catégories
En savoir plus sur Get Started with Curve Fitting Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!