Weierstrass. 发表于 2016-4-15 17:03 
函数定义不完整,具体看myfun.m的第3行。
我的具体程序是这样的 你看看哪里出错了?
function y=myfun(x)
for c=(0:100)
y=-350*(1-exp(-(x(1)+0.65*x(4)+0.16*x(5)+0.16*x(7))))-200-400+c*(x(1)+x(2)+x(3)+x(4)+x(5)+x(6)+x(7));
A=[1, 0, 0, 0.65, 0.16, 0, 0.16;
0, -1, 0, -0.65,0,-0.34,-0.16;
0, 0, -1, 0, -0.16, -0.34, -0.16];
B=[4.47;-3.91;-4.6];
Aeq=[]; Beq=[];
Lb=[0;0;0;0;0;0;0];
[x,fval]=fmincon(@myfun, 0.000000001*ones(1,7)', A,B,Aeq,Beq,Lb);
xmin=x
fmax=-fval
提示我??? Error using ==> fmincon
FMINCON cannot continue because user supplied objective function failed with the following error:
Error: File: F:\MATLAB7\myfun2.m Line: 3 Column: 102
This statement is incomplete.