How to interpolate 2d->2d data
12 ビュー (過去 30 日間)
古いコメントを表示
I have two sets of data. The first set of data contains (x,y) coordinates of a certain number of points, and the second set of data corresponds to the (x',y') image coordinates of the (x,y) points. Is there a way to interpolate this transformation ?
0 件のコメント
回答 (1 件)
Adam Danz
2018 年 8 月 4 日
Your question isn't super clear but I think I understand what you want.
The first data set is (x,y) coordinates. I interpret this as a [n-by-2] matrix of [x,y] coordinates.
The 2nd data set is the same coordinates in (x',y') format which is a vector [1, n*2].
If that's correct, here's how to reshape each data set to the other format. No interpolation is needed.
% Fake data
x = [1:5]';
y = [11:15]';
set1 = [x,y];
set2 = [x',y'];
% set1 -> set2
set_2 = set1(:)'
% set2 -> set1
set_1 = reshape(set2', [], 2)
2 件のコメント
Adam Danz
2018 年 8 月 5 日
That's much clearer (and different) from your question. But there are still some points to clarify. From your attached image, you have the (x,y) coordinates of the black line on the left and you have the (x2,y2) coordinates of the black line on the right, but you'd like to perform the transformations of the left coordinates to the right. Is that correct?
Could you share a minimal working example of your code? Could you also show us what's wrong with the scatteredInterpolant output?
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!