Plotting a line x=constant

Hi,
What is a good way to plot a straight line parallel to y-axis for a particular x value?
I've used this code but the line is dotted
x=3;
y=0:0.001:0.3; %How much is long
plot(x, y, 'LineWidth', 10) % but is not large enough

1 comentario

Ram Lakha Meena
Ram Lakha Meena el 27 de Ag. de 2020
This is what i did and the result:
clear
clc
close all
x=3;
y=0:0.001:0.3; %How much is long
plot(x, y, 'LineWidth', 10) % but is not large enough

Iniciar sesión para comentar.

 Respuesta aceptada

Grzegorz Knor
Grzegorz Knor el 21 de Sept. de 2011

7 votos

Another option:
line([x x],[y(1) y(end)],'LineWidth',10)

Más respuestas (3)

Paulo Silva
Paulo Silva el 21 de Sept. de 2011

1 voto

plot(x*ones(size(y)), y, 'LineWidth', 10)
or
plot(x*ones(1,size(y,2)), y, 'LineWidth', 10)
Svitlana Strunina
Svitlana Strunina el 29 de Mzo. de 2021

1 voto

xline(3);
https://www.mathworks.com/help/matlab/ref/xline.html

Categorías

Etiquetas

Preguntada:

el 21 de Sept. de 2011

Respondida:

el 29 de Mzo. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by