フィルターのクリア

Map array values relative to another array

2 ビュー (過去 30 日間)
Mathew Thomas
Mathew Thomas 2017 年 4 月 25 日
コメント済み: Mathew Thomas 2017 年 4 月 25 日
I have an array of xy coordinates, a = [4000,3000; 4200, 3100; 4014, 2900]; Array 'a' has been translated to lat lon values b = [72.1321, -32.789; 73.1879, -31.8987; 72.89109, -32.8796];
Now I have another set of xy coordinates, a2 = [3600,2900; 4000, 2100; 4200, 3200]; How can I get 'b2' based on interpolating values in 'a','b' and 'a2'?
Thanks, Mathew

採用された回答

Honglei Chen
Honglei Chen 2017 年 4 月 25 日
Maybe something like this?
b2 = reshape(interp1(a(:),b(:),a2(:),'linear','extrap'),size(a2))
HTH

その他の回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2017 年 4 月 25 日
aa = sort(a);
bb = sort(b);
F = {griddedInterpolant(aa(:,1),bb(:,1)),griddedInterpolant(aa(:,2),bb(:,2))};
out = cell2mat(cellfun(@(f,x)f(x),F,num2cell(a2,1),'un',0));
  1 件のコメント
Mathew Thomas
Mathew Thomas 2017 年 4 月 25 日
Both methods work, just that I need to preserve the order as is without sorting.

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

カテゴリ

Help Center および File ExchangeInterpolating Gridded Data についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by