Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab 如何截断数据集绘图_Matlab_Matrix_Plot - Fatal编程技术网

Matlab 如何截断数据集绘图

Matlab 如何截断数据集绘图,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

假设我有一个包含两列(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, 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