MATLAB: How to back interpolation to find x from z and y

interpolationMATLABsimulink

I would like to do "back" interpolation to find an x value from the given values of z and y. (2Dimensional x,y,z matrix table is available). Is there any prepared MATLAB function for it?/ And how to do it in Simulink(Lookup Table Dynamic block is for 1D. I need 2D)?
As an example: x =[01 2 3 4 5]; y=[ 30 40 50 60]
z=[
1 2 3 4 5
3 4 5 6 7
5 6 7 8 10
7 8 10 10 13]
Table=
1 2 3 4 5
---------------
30 ! 1 2 3 4 5
40 ! 3 4 5 6 7
50 ! 5 6 7 8 10
60 ! 7 8 10 10 13
According to this given values, I would like to find the x value for a given data of y=43, and z=6.8
Thanks in advance.

Best Answer

This is easy with interp2 and fzero:
>> X = [1,2,3,4,5]
>> Y = [30,40,50,60]
>> Z = [1,2,3,4,5;3,4,5,6,7;5,6,7,8,10;7,8,10,10,13]
>> y = 43;
>> z = 6.8;
>> fun = @(x)interp2(X,Y,Z,x,y)-z;
>> x = fzero(fun,mean(X))
x = 4.1538
And checking:
>> interp2(X,Y,Z,x,y)
ans = 6.8000