The z coordinate of your function is computed in this line:
ILArray<float> z = ILMath.meshgrid(R * R, R, y);
Since meshgrid is actually used to create the X and Y coordinates for 2 dimensional function evaluation, only the R * R result goes into z. After that line, x,y and z look as follows:
x
<Single> [5,5]
[0]: 0,00000 1,25000 2,50000 3,75000 5,00000
[1]: 0,00000 1,25000 2,50000 3,75000 5,00000
[2]: 0,00000 1,25000 2,50000 3,75000 5,00000
[3]: 0,00000 1,25000 2,50000 3,75000 5,00000
[4]: 0,00000 1,25000 2,50000 3,75000 5,00000
y
<Single> [5,5]
[0]: 0,00000 0,00000 0,00000 0,00000 0,00000
[1]: 1,25000 1,25000 1,25000 1,25000 1,25000
[2]: 2,50000 2,50000 2,50000 2,50000 2,50000
[3]: 3,75000 3,75000 3,75000 3,75000 3,75000
[4]: 5,00000 5,00000 5,00000 5,00000 5,00000
z
<Single> [5,5]
[0]: 0,00000 1,56250 6,25000 14,06250 25,00000
[1]: 0,00000 1,56250 6,25000 14,06250 25,00000
[2]: 0,00000 1,56250 6,25000 14,06250 25,00000
[3]: 0,00000 1,56250 6,25000 14,06250 25,00000
[4]: 0,00000 1,56250 6,25000 14,06250 25,00000
Obviously, z does only depend on x, which gets clear by the resulting surface:
So, the value of z would be: x * x. Or for your specific example:
x=2.2, y=1.6 z =4.84
Edit: In case the underlying function is not known, you could either
- try to learn that function (using ridge_regression() or pinv()), or
- interpolate from the data of the neighboring grid points.
There is currently no corresponding function (like 'interp2') in ILNumerics. However, in your case - where only one single point needs to be interpolated (?), one can find the neighboring grid points and use one of the common interpolation methods.
Edit: With the release of the interpolation toolbox things became significantly easier. You can now interpolate in any dimension in high speed and with a single line.