关于matlab最优化中fmincon函数
主程序如下:x0=[0.17352;-0.33959;3.2403;3.043;-0.046951;6.8701e-011];A=[-1,0,0,0,0,0;0,-1,0...
主程序如下:
x0=[0.17352;-0.33959;3.2403;3.043;-0.046951;6.8701e-011];
A=[-1,0,0,0,0,0;0,-1,0,0,0,0;0,0,-1,0,0,0;0,0,0,-1,0,0;0,0,0,0,-1,0;0,0,0,0,0,-1];
b=zeros(6,1);
[x,fval]=fmincon(@myfun11,x0,A,b,[],[],[],[],@opt115)
辅助函数如下:
function [c,ceq]=opt115(x)
c(1)=-x(1);
c(2)=-x(2);
c(3)=-x(3);
c(4)=-x(4);
主函数就省去了
出现如下问题:
??? Error using ==> fmincon
FMINCON cannot continue because user supplied nonlinear constraint function
failed with the following error:
Output argument "ceq" (and maybe others) not assigned during call to "C:\Documents and Settings\Administrator\桌面\fmincon优化程序\opt115.m (opt115)".
Error in ==> main at 8
[x,fval]=fmincon(@myfun11,x0,A,b,[],[],[],[],@opt115)
问题如上,希望朋友们帮忙给看下,谢谢了! 展开
x0=[0.17352;-0.33959;3.2403;3.043;-0.046951;6.8701e-011];
A=[-1,0,0,0,0,0;0,-1,0,0,0,0;0,0,-1,0,0,0;0,0,0,-1,0,0;0,0,0,0,-1,0;0,0,0,0,0,-1];
b=zeros(6,1);
[x,fval]=fmincon(@myfun11,x0,A,b,[],[],[],[],@opt115)
辅助函数如下:
function [c,ceq]=opt115(x)
c(1)=-x(1);
c(2)=-x(2);
c(3)=-x(3);
c(4)=-x(4);
主函数就省去了
出现如下问题:
??? Error using ==> fmincon
FMINCON cannot continue because user supplied nonlinear constraint function
failed with the following error:
Output argument "ceq" (and maybe others) not assigned during call to "C:\Documents and Settings\Administrator\桌面\fmincon优化程序\opt115.m (opt115)".
Error in ==> main at 8
[x,fval]=fmincon(@myfun11,x0,A,b,[],[],[],[],@opt115)
问题如上,希望朋友们帮忙给看下,谢谢了! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询