matlab垂直线,Matlab:由vector指定的x值的垂直线(Matlab: vertical lines at x-values specified by vector)...

在Matlab中,要根据向量绘制垂直线,如vec = [1 2 3 4 5],正确的方法是使用plot函数的矩阵输入。错误的尝试会导致Z形图形,而正确的代码应该是plot([vec;vec],[lowLine;highLine]),这将在每个x值处绘制垂直线。" 137445966,11382130,迁移学习:预训练权重加载与微调策略,"['迁移学习', '深度学习', '人工智能']
摘要由CSDN通过智能技术生成

Matlab:由vector指定的x值的垂直线(Matlab: vertical lines at x-values specified by vector)

我有一个x值向量,我想在图中添加垂直线,比如行向量: vec = [1 2 3 4 5]

我知道你可以像这样添加单个垂直线:

plot([1 1],[0 1])

(在y = 0到y = 1的情况下,在x = 1处给出垂直线)。

但是,当我尝试类似的东西

vec = [1 2 3 4 5]; lowLine = [0 0 0 0 0]; highLine = [1 1 1 1 1]; plot([vec vec],[lowLine highLine])

它没有给出所需的结果,而是给出了z形。 我哪里错了?

I have a vector of x-values at which I would like to add vertical lines to a graph, say a row vector: vec = [1 2 3 4 5]

I know that you can add single vertical lines like this:

plot([1 1],[0 1])

(gives a vertical line at x=1 from y=0 to y=1).

But when I try something like

vec = [1 2 3 4 5]; lowLine = [0 0 0 0 0]; highLine = [1 1 1 1 1]; plot([vec vec],[lowLine highLine])

It does not

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值