Backwards 2D Interpolation

Hi

I have two scaled 2D wave representing z1 and z2 as a function of x and y. 

I would like to interpolate z1 "backwards" to create two new scaled 2D waves representing  (1) x as a function of y and z1 and (2) z2 as a function of y and z1.

I see how I could use a binarysearchinterp of z(x) at fixed y to build up the new waves but this is less accurate than a true bilinear or spline interp of the 2D "surfaces".

Is there a built-in function for this?

I am struggling to imagine a bit what you are trying to achieve, but for (1), isn't that just a matter of how the data is arranged in a 3D matrix? If you swap the data so that you have [z1][y][x] you are done, no? You can do such data shuffling via

MatrixOP out=transposeVol(in,4)

As for (2), you would first need to figure out how z1 and z2 are related to each other. If you have achieve (1) I guess you want to look up x in your first map and then recast the x in your second map. You may be able to do that by using interp2D on (1). Do you have some example data to better understand what you want?

Thanks. This is not a matter of shuffling the data in a 3D matrix. It is about calculating the 2D surface of x values over a regularly spaced grid of y and z points.

 

The z1 wave has to either increase across the whole x range or decrease across the whole x range, or you will end up with multiple x values for the same combination of y and z1.

Noisy data could make this really hard.

If the z1 range is different for different y values you will also end up with some z1 values in the x(z1, y) wave being out-of-range compared to the original z1(x, y).

Splitting the 2D waves into 1D waves and interpolating those, as you already suggested, seems the best approach to me.