The z coordinate of your function is calculated on this line:
ILArray<float> z = ILMath.meshgrid(R * R, R, y);
Since meshgrid is actually used to create the X and Y coordinates for estimating a two-dimensional function, only the result R * R goes to z. After this line, x, y, and z look like this:
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 depends only on x, which becomes clear from the resulting surface:
So, the value of z will be: x * x. Or for your specific example:
x=2.2, y=1.6 z =4.84
Edit: if the underlying function is unknown, you can either
- try to find out this function (using ridge_regression () or pinv ()) or
- interpolate according to neighboring grid points.
ILNumerics does not currently have a corresponding function (for example, 'interp2'). However, in your case, when you need to interpolate only one point (?), You can find neighboring grid points and use one of the general interpolation methods.
Change With the release of > interpolation tools, it has become much easier. Now you can interpolate in any dimension with high speed and with one line.