MATLAB: How to find the closest z- value inputting x- and y- values from 3D interpolated surface

3d surfaceclosest valueinterpolation

Hello. I really appreciate if, at least, I can get a hint for this problem. With the given number of 3D data (69737X69737X69737) I made a 3D surface creating the meshgrids and using linear interpolation;
x1 = volt;
x2 = temp;
x3 = wss;
v = x3;
%%Interpolation%%
%%Select the number of grids as 1000 X 1000%%
[xq1,xq2] = meshgrid(0.8:0.00045:1.25, 79.1479:0.001205:80.3529);
vq = griddata(x1,x2,v,xq1,xq2,'linear');
%%xq1 = Interpolated volt
%%xq2 = Interpolated temp
%%vq = Interpolated wss
h = surf(xq1,xq2,vq); %colormap(bone);
From this point, I would like to find the closest vq (=Interpolated wss) value inputting (xq1, xq2) value. I have a bunch of files and each of them includes 80000X80000 values of xq1 and xq2. So if I can get an answer for the above question I'd like to call the files step by step and find the closest vq values for all of 80000 points of each files.

Best Answer

doc interp2
You can use 2D inteprolation to achieve your task.
Zi = interp2(X,Y,Z,Xi,Yi) ;
(X,Y,Z) are the values you have. (Xi,Yi) are the values where you want to find respective Zi.