IDW interpolation: subtract coordinate of my interpolating points from the interpolated field

1 view (last 30 days)
Hi,
I’d like to interpolate snow measurements. I have snow depth values (vc) at point location (xc and yc) (coordinates). To use the IDW function, you also have to give the coordinates of the points you want to interpolate, so I chose a square (field x1, y1) around my coordinates. However, the code did not work because my true snow depth values (and coordinates) are also part of this field!
Is it possible to substract the coordinates of my true snow depth values from the field I want to interpolate?
This is my code:
load C2_Z1_fin.mat
xc = C2_Z1_fin(:,1);
yc = C2_Z1_fin(:,2);
za = C2_Z1_fin(:,3);
vc = za/100;
x1 = (606400:1:606700)';
y1 = (91475:1:91675)';
x = x1-xc; %%This do not work!
[Vint] = IDW(xc,yc,vc,x,y,12,'ng',10)
%%%INPUTS
%xc = stations x coordinates (columns) [vector]
%yc = stations y coordinates (rows) [vector]
%vc = variable values on the point [xc yc]
%x = interpolation points x coordinates [vector]
%y = interpolation points y coordinates [vector]
%e = distance weight
%r1 --- 'fr' = fixed radius ; 'ng' = neighbours
%r2 --- radius lenght if r1 == 'fr' / number of neighbours if r1 =='ng'
plot(Vint)
Thanks a lot!

Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!