1

假设我有一个包含 2 列 (x,y) 的数据集绘图向量但是,我不想绘制整个集合,而是将绘图从 x1 截断到 x2,即我知道的一些集合 x 值。我该怎么做?

4

1 回答 1

1

我能想到的两个选项,如果你知道范围的索引,那么:

plot(x(x1:x2),y(x1:x2)); % here x1 and x2 are indices, not values

否则,您始终可以:

range=find(x>x1 & x<x2); % here x1 and x2 are actual values, you can use any other condition needed...
plot(x(range),y(range))
于 2012-09-23T15:36:15.577 回答