3生石 发表于 2012-8-4 01:08 
属于有约束的非线性规划问题
首先编写目标函数(取原函数的相反数):
function f=myfun(x)
很感谢你的帮助……可是按照你的程序运行时,出现以下错误:
>> A=[-1 -9];
b=-30;
lb=[0;3];
ub=[20/9;20];
x0=[2 4];
[x,fval,exitflag]=fmincon(@myfun,x0,A,b,[],[],lb,ub,@nl)
Warning: Large-scale (trust region) method does not currently solve this type of problem,
switching to medium-scale (line search).
> In fmincon at 260
??? Error using ==> fmincon
FMINCON cannot continue because user supplied objective function failed with the following error:
Error using ==> feval
Undefined command/function 'myfun'.
不知道问题出在哪里……麻烦你了