Remove the discontinuity from tan(x) where odd multiples of pi/2
10 次查看(过去 30 天)
显示 更早的评论
Hi i have the function;
f=tan(x)
where
x=linspace(-2pi,2pi,200)
I was wondering if you would know how to remove disconuity of the function which is odd multiples of pi/2.
I was thinking using the rem(x, 2) ==0 function and f(_) = NaN but i dont know how to structure it.
By the way it is for when i plot it, so there are no vertical lines (the disconuity which is all odd multiples of pi/2).
0 个评论
采纳的回答
Star Strider
2014-3-20
编辑:Star Strider
2014-3-20
I suggest:
x=linspace(-2*pi,2*pi,200);
f=tan(x);
f(diff([0 f]) < 0) = NaN;
更多回答(1 个)
Lateef Adewale Kareem
2016-4-12
x=linspace(-2*pi,2*pi,200); f=tan(x); f(abs(diff([0 f])) > 15) = NaN;
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!