|
发表于 2003-9-18 18:42:41
|
显示全部楼层
%%%%%%%%%%%
function f=myfun(x)
f = -x(1) * x(2) * x(3);
%%%%%%%%%%%
function [c,ceq]=mycon(x)
c=2*x(1)^2-x(2)+0*x(3);
ceq=[];
%%%%%%%%%%%
A=[1,5,0,-5];b=[0];Aeq=[];beq=[];
lb=[0,0,0];x0=[0,0,0.75];
[u,fval]=fmincon(@myfun,x0,A,b,Aeq,beq,@mycon)
试着用fmincon这个函数,constr已经快被淘汰了!
|
|