Matlab:如何获得新的测量矢量

时间:2014-06-14 18:23:47

标签: matlab vector

我有以下向量,其中V1,V2是相对于高度Y1,Y2的度量:

Y1 = [32 115 174 468 818 1067 1268 1399 1446 1484 1503 1588 1608 1665 1761 1879 1918 2037 2138 2148];
V1 = [71 54 54 59 65 70 74 76 77 78 70 18 18 19 23 29 26 20 16 15];
Y2 = [32 49 137 782 791 1171 1255 1461 1471 1538 1683 1781 1860 1890 1910 1960 2102 2268 2467 2563];
V2 = [44 58 54 49 49 48 48 38 38 35 19 13 19 32 44 47 57 72 57 50];

interpolation

我会获得一个 V2 向量( V2_new ),它将包含"绿色圆圈" 在蓝线,但我不知道该怎么做。

谢谢

1 个答案:

答案 0 :(得分:0)

如果我们可以假设vyv(y))的函数,那么您可以使用插值:

% Find where green circles "should" be on blue line by y2
v2_interp = interp1(y1, v1, y2); 

% You can ease the equality criteria if you wish
matches = (v2_interp == v2); 

v2_matches = v2(matches);
y2_matches = y2(matches);

enter image description here