# Interpolate 2D waves with non-uniform X,Y scalings NOT defined on the edges

Tue, 05/26/2020 - 09:23 am

I have data that represent values of a function F (X,Y).

X and Y are 1D waves that are neither linear not log scaled but monotonously increasing.

X and Y waves have different number of points , but constitute a grid.

I would like to interpolate the 2D wave to be able to estimate F at values between the grid points.

Browsing Igor Help, it seems that

would do it but this considers that the 1Dwave values correspond to the edges of the "pixels", according to Igor Help:

/W={xWave, yWave}Provides the scaling waves for XYWaves interpolation. Both waves must be monotonic and must haveone more point than the corresponding dimension in srcWave. The waves contain values correspondingto the edges of data pointsin srcWave, so that the X value at the first data point is equal to(xWave[0]+xWave[1])/2./S={x0,dx,xn,y0,dy,yn }Calculates a bilinear interpolation of a subset of the source data. Here x0 is the starting pointin the X-direction, dx is the sampling increment, xn is the end point in the X-direction andthe corresponding values for the Y-direction. If you set x0 equal to xn the operation willcompute the triangulation but not the interpolation.

Is there another way to do a 2D interp from a non-uniform grid ?

I would like to avoid having to compute the 1D waves at the edges, do the 2D interp, then compute the values of the new 1Dwaves corresponding to the centers of the new pixels, not the edges...

Try the Data->Packages->XYZ To Matrix menu.

Then select Macros->XYZ Waves to Matrix.

May 26, 2020 at 11:43 am - Permalink

First I would like to make sure that the OP understands why image interpolate uses the edges of the pixels. When you have any non-linear axis, if you only define a value at the center of the pixel you are missing one more parameter to define at what location the pixel "ends". This is essentially the same as saying that the constant pixel value extends to some edge point...

If this is not an option that would work with your data then you will need to convert your data into an XYZ triplet wave. You can then either use Jim's advice from above or use ImageInterpolate with the Voronoi keyword. Both approaches use the same code internally to triangulate your domain and compute the voronoi interpolation. You should be aware though that the interpolation is only valid inside the convex domain defined by your XY locations.

AG

May 26, 2020 at 11:50 am - Permalink