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!