Failure in initial objective function evaluation. LSQCURVEFIT cannot continue.

189 views (last 30 days)
raw = xlsread('File', 2); % read in sheet number 2
Pc = raw(60:141, 1);
Sw = raw(60:141, 9);
plot(Sw,Pc,'ro')
F = @(x,xdata)1-x(1)*exp(-(x(2)/xdata)^(x(3)));
x0 = [3 6 0.6];
[x,resnorm,~,exitflag,output] = lsqcurvefit(F,x0,Sw,Pc)
I keep getting this error.
Error in Skelt_LS_Code (line 16)
[x,resnorm,~,exitflag,output] = lsqcurvefit(F,x0,Sw,Pc)
Caused by:
Failure in initial objective function evaluation. LSQCURVEFIT cannot continue.
Any help is appreciated. Thank you

Accepted Answer

Walter Roberson
Walter Roberson on 6 Jan 2020
F = @(x,xdata)1-x(1)*exp(-(x(2)./xdata).^(x(3)));
  6 Comments

Sign in to comment.

More Answers (1)

Alex Sha
Alex Sha on 7 Jan 2020
Hi,Thaer Ismail, which is your exact fit function: "ydata=1-x1*exp(-(x2/xdata)^x3)" or "ydata=1-x1*exp((-x2/xdata)^x3)" ?
if the former, take initial start values as:
x0 = [-23124 0.3 -2.2];
c245.jpg
  1 Comment
Thaer Ismail
Thaer Ismail on 7 Jan 2020
It is actually the former.
I tried the initial guesses that you graciously provided but still get a very bad fit.
Thank you.skelt bad 3.JPG

Sign in to comment.

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!