Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
初级会员
注册日期: 2012-03-11
帖子: 1
声望力: 0 ![]() |
![]()
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 |
![]() |
![]() |