Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue
显示 更早的评论
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 个评论
madhan ravi
2019-4-7
k1????
Mojtaba Mohareri
2019-4-7
编辑:Stephan
2019-4-7
Star Strider
2019-4-7
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
2019-4-7
编辑:Mojtaba Mohareri
2019-4-7
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Common Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!