MATLAB: How to find y value from the 3d graph with a known x and z values

%fafind

I have a question, and I hope you can answer it
I have plot 3d graph ( as i have attached in image 1 ) between
x=[2.6,5.2,14,23.3,28.3,2.6,5.2,14,23.3,28.3,2.6,5.2,14,23.3,28.3]
y=[3.5,6.9,17.7,29.1,35.2,3.5,6.8,17.5,28.7,34.8,3.4,6.6,16.9,27.6,33.5]
z=[450,450,450,450,450,350,350,350,350,350,250,250,250,250,250]
after that
I have 20 patient
and each patient have associated with different z , x and y values
and for each patient i have z and x values , but i dont have y
And I want to know y value for each patient
so that why i have collect data ( as you can see above )( and all this data i have collect it are in the range of my patient ) and i have plot a 3d graph to estimate the y for each patent from this data ( lookup table )
For example
Patient number 4
Z = 367
x = 20
Y = ???
As you can see from the 3d image i have attached ( image 2 and 3) I can estimate what is the y for patient 4, But it will be very difficult and not accurate
so I am looking for stander fit to estimate y for each z and x values I have for 20 patient
I am looking for a function to estimate y for each z and x values I have for 20 patient

Best Answer

Seems fairly simply, just build a scattered interpolant and use that to interpolate your query points.
x=[2.6,5.2,14,23.3,28.3,2.6,5.2,14,23.3,28.3,2.6,5.2,14,23.3,28.3];
y=[3.5,6.9,17.7,29.1,35.2,3.5,6.8,17.5,28.7,34.8,3.4,6.6,16.9,27.6,33.5];
z=[450,450,450,450,450,350,350,350,350,350,250,250,250,250,250];
YfromXZ = scatteredInterpolant(x(:), z(:), y(:)); %interpolant that lets you calculate y knowing x and z
queryx = 20; %can be a vector/matrix
queryz = 367; %can be a vector/matrix as long as it's the same size as queryx
matchingy = YfromXZ(queryx, queryz);
%for visualisation
figure; scatter3(x, y, z); hold('on'); plot3(queryx, matchingy, queryz, 'r*');