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!