MATLAB: How to plot vertical lines

linevertical line

This is the script:
x=[0:0.1:10]; x1=5;
plot(x,2*sin(x),x,5*sin(x),x,cos(x));
line([x1 x1],???????);
I would like to plot the vertical line from the top to the bottom without knowing the y-axis limits.
Thanks in advance!

Best Answer

x=[0:0.1:10];
x1=5;
plot(x,2*sin(x),x,5*sin(x),x,cos(x));
y1=get(gca,'ylim')
hold on
plot([x1 x1],y1)