关于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,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,[],[],[],[
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/20 19:33:25
关于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,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,[],[],[],[
关于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,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)
希望朋友们帮忙给看下,
关于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,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,[],[],[],[
nonlinear constraint function(非线性约束辅助函数)改成
function [c,ceq]=opt115(x)
c(1)=-x(1);
c(2)=-x(2);
c(3)=-x(3);
c(4)=-x(4);
cep=[];