Can I make the plot skip jumps in data?

조회 수: 11 (최근 30일)
OG
OG 2021년 4월 17일
댓글: OG 2021년 4월 18일
I have a plot of data, where the y values are bounded from -pi to pi. After a value goes above pi, it starts at the bottom of the plot with a value of pi. However, when plotted this means there is a line connecting the jump in value. Is there a way to plot the data without the lines connecting the values at each jump point?
  댓글 수: 2
OG
OG 2021년 4월 18일
That tries to fix the discontinuity by moving the data set by factors of 2pi. I want the discontinuities to stay, just without the line connecting them.

댓글을 달려면 로그인하십시오.

채택된 답변

Atsushi Ueno
Atsushi Ueno 2021년 4월 18일
The idea is replacing discontinus part by NaN values.
x = 1:0.1:pi*10;
y = mod(x,pi*2)-pi;
y(abs(diff(y))>2) = NaN;
plot(x,y);
  댓글 수: 1
OG
OG 2021년 4월 18일
Thanks, this seems to do what I want!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by