MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [讨论]利用fimincon求解有约束的非线性优化问题出错 (https://www.labfans.com/bbs/showthread.php?t=6376)

realyw 2009-02-11 10:43

[讨论]利用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中的一个例子,请问各位大侠为什么会这样呢?


所有时间均为北京时间。现在的时间是 06:24

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.