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 Center および File ExchangeAnnotations についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by