How can I perform interpolation on points that lie within a radius certain using GRIDDATA in MATLAB (R2013a)?

2 views (last 30 days)
I am working with datasets which have many millions of points and there is significant time involved in creating gridded data points.
I would like to perform interpolation only on points that fall inside a radius 'R' from a target point (X0,Y0). How can I do that? And is there a way I can retrieve the pairwise distances and obviate the need to recalculate them?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 25 Feb 2021
Edited: MathWorks Support Team on 25 Feb 2021
Unfortunately, one cannot retrieve the pairwise distances that are computed during the intermediate steps of the interpolation. However, to perform interpolation on scattered points that fall within a radius "R", you can follow these steps:
1. Say, I create some random data points (X,Y) and define their distance to the target point (X0,Y0)
>> X = rand(10,1);
>> Y = rand(10,1);
>> dX = X - X0;
>> dY = Y - Y0;
>> dists = sqrt(dX.^2+dY.^2);
2. We now find which points fall within a radius "R" from (X0,Y0) using logical indexing:
>> indices = d(d>R);
>> XqNew = Xq(indices);
>> YqNew = Yq(indices);
More on logical indexing:

More Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Products


Release

R2013a

Community Treasure Hunt

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

Start Hunting!