MATLAB Answers

pallav pal

How to draw x=2 line using plot command

Asked by pallav pal
on 15 Feb 2013

I want to draw the vertical line x=2. I want to draw it by using plot command in x-y plane, x-is the horizontal axis. How to draw it?

I do not want to use the following

    line([2 2], [0 10])

to draw a line from (2,0) to (2,10)




No products are associated with this question.

2 Answers

Answer by Azzi Abdelmalek
on 15 Feb 2013
Edited by Azzi Abdelmalek
on 15 Feb 2013
 Accepted answer
plot([2 2], [0 10])

%or maybe you want

plot([2 2],ylim)


Answer by ToLos Mil
on 15 Feb 2013

See the answer given at the following link


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today