查看单个帖子
旧 2009-02-11, 10:43   #1
realyw
初级会员
 
注册日期: 2009-02-07
年龄: 43
帖子: 2
声望力: 0
realyw 正向着好的方向发展
默认 [讨论]利用fimincon求解有约束的非线性优化问题出错

利用fimincon求解有约束的非线性优化问题出错
如下:
function f=myfunction(x)
f=-x(1)*x(2)*x(3);

在命令窗口输入
>> A=[-1 -2 -2;1 2 2];
>> b=[0;72];
>> x0=[10;10;10];
>> [x,fval] = fmincon(@myfunction,x0,A,b)
Warning: Large-scale (trust region) method does not currently solve this type of problem,
switching to medium-scale (line search).
> In fmincon at 274
??? Error using ==> fmincon
FMINCON cannot continue because user supplied objective function failed with the following error:
Undefined function or variable 'b'.

最近在学MATLAB,这是fmincon命令help中的一个例子,请问各位大侠为什么会这样呢?
realyw 当前离线   回复时引用此帖