Borrar filtros
Borrar filtros

I have a question about plot. Plesase help me.

2 visualizaciones (últimos 30 días)
Nguyen Trong Nhan
Nguyen Trong Nhan el 20 de Dic. de 2013
Comentada: Nguyen Trong Nhan el 20 de Dic. de 2013
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.

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 20 de Dic. de 2013
Editada: Azzi Abdelmalek el 20 de Dic. de 2013
s=get(gca,'ylim')
hold on;
plot([a a],s)
  2 comentarios
Azzi Abdelmalek
Azzi Abdelmalek el 20 de Dic. de 2013
For your case
hold on;
plot([a a],[3 5])
Nguyen Trong Nhan
Nguyen Trong Nhan el 20 de Dic. de 2013
thank you very much

Iniciar sesión para comentar.

Más respuestas (1)

Geert
Geert el 20 de Dic. de 2013
Editada: Geert el 20 de Dic. de 2013
% 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 comentarios
Geert
Geert el 20 de Dic. de 2013
Corrected it...
Nguyen Trong Nhan
Nguyen Trong Nhan el 20 de Dic. de 2013
thanks very much

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by