Plotting a line x=constant
Afficher commentaires plus anciens
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 commentaire
Ram Lakha Meena
le 27 Août 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

Réponse acceptée
Plus de réponses (3)
Francisco Williams
le 24 Août 2020
2 votes
You can use xline command
Paulo Silva
le 21 Sep 2011
plot(x*ones(size(y)), y, 'LineWidth', 10)
or
plot(x*ones(1,size(y,2)), y, 'LineWidth', 10)
Svitlana Strunina
le 29 Mar 2021
1 vote
xline(3);
https://www.mathworks.com/help/matlab/ref/xline.html
Catégories
En savoir plus sur Annotations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!