How to interpolate complex data along one dimension to a larger size?

5 ビュー (過去 30 日間)
YZ
YZ 2014 年 10 月 29 日
コメント済み: Adam 2014 年 10 月 29 日
I have a 200by79 matrix (A) and want to interpolate to a 200by84 matrix (B). They are complex data. I followed the suggestion by Chad Greene:
samplepoints = linspace(1,10,79);
coordinatesofthequerypoints = linspace(1,10,84);
B = zeros(200,84);
for xx_ct = 1:200
B(xx_ct,:) = interp1(samplepoints,A(xx_ct,:),coordinatesofthequerypoints);
end
These codes just add NaN to B(:,79) to B(:, 84). Not my goal. What I want is to add 5 lines evenly distributed in the original 79 lines of A, the values of the new lines can be the average of the neighborhood lines, so that B is 84 lines. Is there a way to do this? Thank you.
  1 件のコメント
Adam
Adam 2014 年 10 月 29 日
That all seems to work fine for me. Obviously I don't have your matrix A so I just used:
A = rand(200,79) + i * rand(200,79);
but the data was stretched out over the extra 5 points as expected.
interp2 might be faster than using interp1 with a for loop, though I don't know as I haven't tried it. You can just pass in the same grid for new and old in the 2nd dimension to do effectively no interpolation across rows, but whether interp2 is clever enough to see that and do no extra work I don't know.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by