필터 지우기
필터 지우기

How to specify an x-range for a yline?

조회 수: 86 (최근 30일)
Harr
Harr 2021년 3월 22일
댓글: Harr 2021년 3월 22일
we have the following code;
x = -2:0.25:2;
[X,Y] = meshgrid(x);
Z = X.*exp(-X.^2-Y.^2);
contour(X,Y,Z,30)
yl = yline(0,'--','y = 0','LineWidth',3);
It returns the following graph:
How to specify a range for the line? for example if i want to see the line only between x=-1 to x=1?

채택된 답변

Walter Roberson
Walter Roberson 2021년 3월 22일
You cannot do that with yline() . You need to line() or plot() the line into place, and text() the label into place.
  댓글 수: 3
Walter Roberson
Walter Roberson 2021년 3월 22일
plot([x1; x2], [y; y], 'LineWidth',3)
Harr
Harr 2021년 3월 22일
Thankl you very much ^_^

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by