I am trying to look up and interpolate to the nearest X value from a set of gridded data. This data is a formatted so that X is an 12×1 column vector, Y is a 17×1 column vector, and Z is a 12×17 matrix.
Here is an example data set:
X =[11;10;9;8;7;6;5;4;3;2;1;0]Y=[0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16]Z=[ 3.50 3.32 3.12 2.89 2.63 2.30 1.91 1.51 1.18 0.88 0.59 0.29; 3.29 3.08 2.85 2.59 2.29 1.95 1.58 1.22 0.92 0.68 0.45 0.22; 3.35 3.12 2.87 2.58 2.26 1.92 1.57 1.21 0.90 0.65 0.43 0.22; 3.41 3.17 2.90 2.60 2.29 1.95 1.62 1.28 0.95 0.68 0.45 0.23; 3.45 3.20 2.93 2.64 2.34 2.02 1.70 1.37 1.03 0.74 0.49 0.24; 3.47 3.22 2.96 2.69 2.40 2.10 1.78 1.46 1.12 0.80 0.53 0.26; 3.48 3.25 3.00 2.74 2.46 2.17 1.87 1.54 1.21 0.87 0.57 0.28; 3.50 3.27 3.03 2.78 2.52 2.24 1.95 1.63 1.29 0.94 0.61 0.31; 3.50 3.29 3.06 2.83 2.57 2.31 2.02 1.70 1.37 1.01 0.66 0.33; 3.50 3.30 3.08 2.86 2.62 2.36 2.08 1.78 1.44 1.08 0.71 0.35; 3.49 3.29 3.09 2.87 2.64 2.40 2.13 1.84 1.51 1.15 0.76 0.38; 3.45 3.27 3.07 2.87 2.65 2.42 2.17 1.89 1.57 1.21 0.81 0.41; 3.37 3.20 3.02 2.83 2.63 2.41 2.17 1.91 1.62 1.27 0.87 0.43; 3.09 2.93 2.77 2.59 2.40 2.20 1.98 1.74 1.47 1.15 0.77 0.39; 2.47 2.33 2.17 2.01 1.85 1.67 1.47 1.26 1.03 0.78 0.52 0.26; 1.90 1.78 1.65 1.51 1.38 1.23 1.07 0.91 0.73 0.55 0.37 0.18; 1.47 1.37 1.27 1.16 1.05 0.93 0.81 0.68 0.54 0.41 0.27 0.14]
I would like to be able to take a Y and Z value, and look up an X value.
I've tried griddedInterpolant, but was not able figure out the function.
Any help appreciated
Best Answer