Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 工程数学软件 > MATLAB论坛
MATLAB论坛 一切MATLAB相关问题在此讨论。
 
 
主题工具 显示模式
旧 2012-03-11, 01:30   #1
chcm
初级会员
 
注册日期: 2012-03-11
帖子: 1
声望力: 0
chcm 正向着好的方向发展
默认 关于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
chcm 当前离线   回复时引用此帖
 


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码



所有时间均为北京时间。现在的时间是 12:10


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