I have a question about plot. Plesase help me.

조회 수: 2 (최근 30일)
Nguyen Trong Nhan
Nguyen Trong Nhan 2013년 12월 20일
댓글: Nguyen Trong Nhan 2013년 12월 20일
I want to draw a line x = a perpendicular to the x axis in matlab. How do I do ? (with a = constant) value y from 3 to 5.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 12월 20일
편집: Azzi Abdelmalek 2013년 12월 20일
s=get(gca,'ylim')
hold on;
plot([a a],s)
  댓글 수: 2
Azzi Abdelmalek
Azzi Abdelmalek 2013년 12월 20일
For your case
hold on;
plot([a a],[3 5])
Nguyen Trong Nhan
Nguyen Trong Nhan 2013년 12월 20일
thank you very much

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

추가 답변 (1개)

Geert
Geert 2013년 12월 20일
편집: Geert 2013년 12월 20일
% define your constant:
a = 5;
% define y limits
ymin = -10;
ymax = 10;
% define x and y values
x = a*ones(2,1);
y = linspace(ymin,ymax,length(x));
% plot the result
figure()
plot(x,y,'r-')
xlabel('x')
ylabel('y')
title('plot of x = a')
  댓글 수: 3
Geert
Geert 2013년 12월 20일
Corrected it...
Nguyen Trong Nhan
Nguyen Trong Nhan 2013년 12월 20일
thanks very much

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

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by