Matlab 如何截断数据集绘图
假设我有一个包含两列(x,y)的数据集plot vectorMatlab 如何截断数据集绘图,matlab,matrix,plot,Matlab,Matrix,Plot,假设我有一个包含两列(x,y)的数据集plot vector 但是,我不想绘制出整个集合,而是将绘图从x1截断为x2,即我知道的某个集合x值。我该怎么做呢?如果您知道范围的指数,我可以想到两个选项: 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, yo
但是,我不想绘制出整个集合,而是将绘图从x1截断为x2,即我知道的某个集合x值。我该怎么做呢?如果您知道范围的指数,我可以想到两个选项:
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))
range=find(x>x1&x我能想到的两个选项,如果你知道范围的指数,那么:
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))
range=find(x>x1&x