MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [求助]MATLAB帮助中的例题,我在运行时出现的错误 (https://www.labfans.com/bbs/showthread.php?t=6113)

libaomail 2009-01-02 17:56

[求助]MATLAB帮助中的例题,我在运行时出现的错误
 
function f = myfun(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(@myfun,x0,A,b)

〉〉myfun


??? Input argument "x" is undefined.

Error in ==> myfun at 2
f=-x(1)*x(2)*x(3);

这是MATLAB帮助中的例题,我在运行时出现的错误,请各位给予帮助。

meteorite 2009-01-02 20:58

回复: [求助]MATLAB帮助中的例题,我在运行时出现的错误
 
在命令行中给出 数组 x 的值。

lingyun422 2009-01-02 22:46

回复: [求助]MATLAB帮助中的例题,我在运行时出现的错误
 
楼上正解。。。。。


所有时间均为北京时间。现在的时间是 13:26

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