MATLAB: Inverse distance weighting on matrix

distanceweight

hi
I have Below matrix that distanse from 17 point in image
How i can calculate inverse distance weighting on this matrix?
how weighting on distance that have minim distanse for each row?

Best Answer

This 17-by-17 matrix looks like it was made by pdist2(). And you say it is the distance of every point to every other point. If you want 1 over the distance, just do
inverseDistances = 1 ./ Dist;
To get the min value of inverseDistances, do
minsPerRow = min(inverseDistances, [], 2);
To get the min distance of the original Dist, do
dist2 = Dist; % Initialize
dist2(dist2 == 0) = inf; % Trick to get it to ignore zero distances (point to itself)
minsPerRow = min(dist2, [], 2);