# Interpolate 2D (G Dataflow)

Version:

Performs two-dimensional interpolation using a selected interpolation method based on the lookup table defined by arrays of values of dependent and independent variables.

## method

Interpolation method.

Name Value Description
nearest 0

Selects the Z value that corresponds to the X, Y value that is nearest to the current xi, yi value. The interpolated value is set to the nearest data point.

bilinear 1

Sets the interpolated values to points along the line segments that connect X and Y.

bicubic 2

Yields an interpolated point from a bicubic surface that covers sixteen of the closest X, Y, Z data points and guarantees that the first partial derivatives and the second-order mixed derivative of the interpolated surfaces are continuous.

bicubic spline 3

Guarantees that the first and second partial derivatives of the cubic interpolating polynomials are continuous, even at the data points.

The Nearest Method

The nearest method finds the point nearest to (xim, n, yim, n) and commits the corresponding z value in Z to zim, n. In the following illustration, zim, n = zi, j + 1.

The Bilinear Method

The bilinear method calculates the 1D linear interpolation twice along the x-axis and returns the interpolated values at points a and b, represented by the blue dots in the following illustration. This node then calculates the 1D linear interpolation along the y-axis, represented by the line segment that connects a and b in the following illustration, and returns zim, n.

The Bicubic Method

Use the bicubic method to perform interpolation within grid rectangles. This method ensures that the inside interpolated surfaces, their first partial derivatives, and the second-order mixed derivative all are continuous.

The Bicubic Spline Method

This method performs interpolation along one axis using the cubic spline method and then along the other axis using the same method. The bicubic spline method ensures that the first and second partial derivatives of the interpolation polynomials are continuous.

Default: bilinear

## Z

2D array of tabulated values of the dependent variable.

## X

2D array of tabulated values of the first independent variable.

All interpolation methods require that X be monotonic along each row, and all rows must be identical. Otherwise, this node uses only the first row of X to perform the interpolation. If X is not empty, the number of columns in X must equal the number of columns in Z. If X is empty, this node treats X as an array whose size equals the size of Z and whose rows are [0, 1, …, N - 1], where N is the number of columns in Z.

## Y

2D array of tabulated values of the second independent variable.

All interpolation methods require that Y be monotonic along each column, and all columns must be identical. Otherwise, this node uses only the first column of Y to perform the interpolation. If Y is not empty, the number of rows in Y must equal the number of rows in Z. If Y is empty, this node treats Y as an array whose size equals the size of Z and whose columns are [0, 1, …, M - 1]T , where M is the number of rows in Z.

## ntimes

Locations of the interpolation points.

Interpolations between each X element and each Y element are repeated ntimes. If you wire data to xi or yi, this node ignores ntimes.

## error in

Error conditions that occur before this node runs. The node responds to this input according to standard error behavior.

Default: No error

## xi

2D array of values of the first independent variable at which interpolated values of the dependent variable are to be computed.

## yi

2D array of values of the second independent variable at which interpolated values of the dependent variable are to be computed.

The size of yi must equal the size of xi.

## zi

Is the output 2D array of interpolated values that correspond to the independent variable values.

## xi used

2D array of values of the first independent variable at which interpolated values of the dependent variable are computed.

If you wire data to xi, xi used returns xi unchanged. Otherwise, xi used returns an array with identical rows of 2ntimes - 1 points located evenly between each two adjacent elements in the first row of X, and the number of rows in xi used equals the number of rows in yi used.

## yi used

2D array of values of the second independent variable at which interpolated values of the dependent variable are computed. If you wire data to yi, yi used returns yi unchanged. Otherwise, yi used returns an array with identical columns of 2ntimes - 1 points located evenly between each two adjacent elements in the first column of Y, and the number of columns in yi used equals the number of columns in xi used.

## error out

Error information. The node produces this output according to standard error behavior.

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported