Failure in initial objective function evaluation. LSQCURVEFIT cannot continue.
130 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Thaer Ismail
el 6 de En. de 2020
Comentada: Walter Roberson
el 27 de Feb. de 2020
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
0 comentarios
Respuesta aceptada
Walter Roberson
el 6 de En. de 2020
F = @(x,xdata)1-x(1)*exp(-(x(2)./xdata).^(x(3)));
6 comentarios
Thi Na Le
el 27 de Feb. de 2020
ydata in previous reply was wrong. this is modification:
a0=4;
xdata=...
[5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150 155 160 165 170 175 180];
ydata=...
[0.04178 0.081 0.09475 0.1157 0.1326 0.1468 0.1587 0.169 0.178 0.186 0.193 0.199 0.205 0.211 0.215 0.22 0.224 0.229 0.233 0.238 0.242 0.245 0.248 0.251 0.254 0.257 0.258 0.261 0.264 0.266 0.269 0.272 0.274 0.277 0.273 0.275];
fun=@(x,xdata)a0*(1+((4.5*x(1)*x(2)*xdata)/(5.5+x(2)*xdata)));
x0=[0.01 0.0001];
>> plot(xdata,ydata,'o')
>> x = lsqcurvefit(fun,x0,xdata,ydata)
Error using lsqcurvefit (line 262)
Function value and YDATA sizes are not equal.
Más respuestas (1)
Alex Sha
el 7 de En. de 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];
Ver también
Categorías
Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!