1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| (1)构造函数 function f= con_fun1(x) p1=17; p2=2.67; k1=0.3; k2=8; p3=1700; N1=550/(1+1.2*exp(-0.8*x(1))); N2=25/(1+1.1*exp(-0.4*x(2))); f=-1*(k1*p1*N1+k1*p3*N2+(k2-x(1)-x(2))*N1*p2); end (2)操作代码 OPTIONS=optimset('display','iter','LargeScale','off'); lb=[0 0]; hb=[20 10]; A=[1 1;-1 -1]; k2=30; b=[k2;0]; [x,fval,exitflag,output]=fmincon(@con_fun1,[1,1],A,b,[],[],lb,hb,[],OPTIONS);
|