回 帖 发 新 帖 刷新版面

主题:求助!!!!!!!!!!!!!!!!!!

%opt1o.m
function f=myfun(x)
f=0.001015+0.20167*x(1)+0.35298*x(2)+0.1134*x(3)-0.000003125*x(5);
%opt1c.m
function [c,ceq]=mycon(x)
c(1)=-245.549-0.31353*x(1)-0.031783*x(3)-0.0000000065221*x(4)+0.02266*x(5)+0.018016*x(6)+0.14134*x(7)+513.9353/x(1)-1950.6186/x(4)+102.3819/x(5)+146058.0306/x(7)-240;
c(2)=5-(-149.535+0.72621*x(1)+4.0754*x(2)+0.049324*x(3)-0.0017744*x(5)-0.0054566*x(6)+0.16768*x(7)-0.0037029/x(1)-0.10639/x(2)+0.0000099499/x(6)-0.000072904/x(7));

A=[-1 0 0 0 0 0 0
    1 0 0 0 0 0 0
    0 -1 0 0 0 0 0 
    0 1 0 0 0 0 0
    0 0 -1 0 0 0 0
    0 0 1 0 0 0 0
    0 0 0 -1 0 0 0
    0 0 0 1 0 0 0
    0 0 0 0 -1 0 0
    0 0 0 0 1 0 0
    0 0 0 0 0 -1 0
    0 0 0 0 0 1 0
    0 0 0 0 0 0 -1
    0 0 0 0 0 0 1];
b=[-43.23;87.84;-14.33;21.39;-48.70;66.73;-1000;1000000000;-80;160;-240;480;-1000;1200];
x0=[43.23;14.33;48.70;1000;80;240;1000];
lb=zeros(7,1);
[x,fval,exitflag,output,lambda]=fmincon(@opt1o,x0,A,b,[],[],lb,[],@opt1c)

运行以上程序总是出现
FMINCON cannot continue because user supplied nonlinear constraint function
failed with the following error:
One or more output arguments not assigned during call to 'f:\MATLAB701\work\opt1c.m (opt1c)'.

请各位大侠指教

回复列表 (共1个回复)

沙发

我素很正经滴SF了=。=那你就看看呗喜欢他么喜欢就OK了~

我来回复

您尚未登录,请登录后再回复。点此登录或注册