MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB基础] 关于ezplot作图的求助 (https://www.labfans.com/bbs/showthread.php?t=14379)

chcm 2012-03-11 01:30

关于ezplot作图的求助
 
function f=fun1(x)
if x>1
f=x^2+1;
else if x<=0
f=x^3;
else
f=2*x;
end
end


function f=fun2(x)
if x>1
f=x^2+1;
else if x<=1&x>0
f=2*x;
else
f=x^3;
end
end

问哈懂Matalab的同志,为什么
ezplot('fun1',[-2,2])
所画的函数图是最后一个表达式的图,而
ezplot('fun2',[-2,2])所画的图是对的,但有如下警告:
Warning: Function failed to evaluate on array inputs; vectorizing the function may
speed up its evaluation and avoid the need to loop over array elements.
> In ezplot>ezplot1 at 463
In ezplot at 148


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

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