Alternative function to scatteredInterpolant

19 次查看(过去 30 天)
Hello. I was wondering if anyone would know any alternative function to scatteredInterpolant (if possible that can be implemented also in Python) so that it can be equivalent to the one I show below.
function data_out = test_scatteredInterpolant (data_input)
U = rand(20,20);
V = rand(20,20);
[X,Y] = meshgrid(1:20,1:20);
% Create matrix with specific format.
aux_array = [reshape(U,[],1) reshape(V,[],1) reshape(X,[],1) reshape(Y,[],1)];
% Apply scatteredInterpolant with vector arrays.
FX = scatteredInterpolant(aux_array(:,1),aux_array(:,2), aux_array(:,3));
FY = scatteredInterpolant(aux_array(:,1),aux_array(:,2), aux_array(:,4));
% Apply FX and FY to the desired input.
data_out(:,1) = FX(data_input(:,1),data_input(:,2));
data_out(:,2) = FY(data_input(:,1),data_input(:,2));
end
Basically, the function constructs an interpolant for the matrices U,V,X and another for U,V,Y and then applies them to the points given as input, as the example below:
data_out = test_scatteredInterpolant(rand(10,2));
Note. The actual function does not work with random values but for the sake of an example I think it is more visual.

采纳的回答

KSSV
KSSV 2021-7-29
Have a look on griddata.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Filter Analysis 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by