Matlab中的垂直反射线? [英] Vertical refline in matlab?

查看:110
本文介绍了Matlab中的垂直反射线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Matlab中绘制垂直参考线?例如我想画一条x = 5的线.显然,使用inf根本没有帮助.有人可以给些建议吗?

How do I draw a vertical refline in matlab? e.g. I want to plot a line of x=5. Obviously using inf does not help at all. Can anyone give some advice?

推荐答案

您可以为x创建一个具有许多相同值的向量.像这样:

You can create a vector with many identical values for x. Something like this:

x = 5*ones(1,100);
y = 1:100;
plot(x,y)

或使用line函数:

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

要自动检测行范围,请使用ylim:

To automatically detect the range of line, use ylim:

plot(1:10)

line([5,5],ylim)

这篇关于Matlab中的垂直反射线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆