I have a question about plot. Plesase help me.

1 次查看(过去 30 天)
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)

更多回答(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')

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by