Objective function is returning Inf or NaN values at initial point. lsqcurvefit cannot continue.
Afficher commentaires plus anciens
Hi guys, I tried to fitting my data with following code
k0= 3.5e+05; % (s-1)
lamda=7.5e-10; % (m)
n=0.92e-20;
KbT=4.11e-21; % (J)
p=[k0, lamda, n];
func=@(p,ydata)2*p(1)*p(2)*sinh((0.072*cosd(70)-0.0623.*cosd(ydata))/(2*KbT*p(3)));
lb=[1e+1; 1e-12; 1e-15]; % lower bound
ub=[1e+9; 1e-6; 1e-25]; % upper bound
f=lsqcurvefit(func, p, ydata, xdata, lb,ub);
plot(xdata,ydata,'ko',xdata,func(f,ydata),'b-')
But, when I ran, the code results in:
Error using lsqncommon
Objective function is returning Inf or NaN values at initial point. lsqcurvefit cannot continue.
Error in lsqcurvefit (line 274)
lsqncommon(funfcn,xCurrent,lb,ub,options,defaultopt,optimgetFlag,caller,...
Error in mkt (line 21)
f=lsqcurvefit(func, p, ydata, xdata, lb,ub);
I tried to look at my data, but it looks find to me. Please see the attachment for the data reference, column 1 is xdata, column 2 is ydata.
Thanks for suggestion.
Réponse acceptée
Plus de 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!