Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue
Ältere Kommentare anzeigen
My currenct script looks like this:
function m=F(x)
k11=x(1);
k12=x(2);
k13=x(3);
k14=x(4);
l=x(5);
f1(y1,y2,y3,y4,z1)=(-(z1^3)/(y3^2))*(3*(y2-y1+y3^(-1)-z1/10)^2+(1/5)*(y2-y1+y3^(-1)-(z1)/10))-y4;
f2(y1,y2,y3,y4,z1)=1/10*z1-y4;
f3(y1,y2,y3,y4,z1)=(z1^3)*(3*(y2-y1+y3^(-1)-z1/10)^2+(1/5)*(y2-y1+y3^(-1)-(z1)/10));
f4(y1,y2,y3,y4,z1)=y1-y3^(-1);
g(y1,y2,y3,y4,z1)=(y1-y3^(-1))^2+y4^2-1/10*z1;
J1(y1,y2,y3,y4,z1)=jacobian([f1,f2,f3,f4],[y1,y2,y3,y4]);
J1=J1(2,2,1,0,10);
J2(y1,y2,y3,y4,z1)=jacobian([f1,f2,f3,f4],[z1]);
J2=J2(2,2,1,0,10);
J3(y1,y2,y3,y4,z1)=jacobian([g],[y1,y2,y3,y4]);
J3=J3(2,2,1,0,10);
J4(y1,y2,y3,y4,z1)=jacobian([g],[z1]);
J4=J4(2,2,1,0,10);
k1=[k11;k12;k13;k14];
m(1)=f1(2,2,1,0,10)+0.44*(J1(1,:)*k1 +J2(1,:)*l)-k11;
m(2)=f2(2,2,1,0,10)+0.44*(J1(2,:)*k1 +J2(2,:)*l)-k12;
m(3)=f3(2,2,1,0,10)+0.44*(J1(3,:)*k1 +J2(3,:)*l)-k13;
m(4)=f4(2,2,1,0,10)+0.44*(J1(4,:)*k1 +J2(4,:)*l)-k14;
m(5)=g(2,2,1,0,10)+0.44*(J3*k1 +J4(1,:)*l);
end
x0=[1,1,1,1,1];
fsolve(@F,x0)
Still nothing seems to get this working, can anyone help me out?
Thanks in advance.
4 Kommentare
madhan ravi
am 7 Apr. 2019
k1????
Mojtaba Mohareri
am 7 Apr. 2019
Bearbeitet: Stephan
am 7 Apr. 2019
Star Strider
am 7 Apr. 2019
It’s difficult to understand what you‘re doing.
However, you need to avoid using symbolic variables in the function to use as your function argument to fsolve. Use the matlabFunction function to create a numeric function fsolve can use.
Mojtaba Mohareri
am 7 Apr. 2019
Bearbeitet: Mojtaba Mohareri
am 7 Apr. 2019
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Common Operations finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!