Performs two-dimensional interpolation using a selected interpolation method based on the lookup table defined by X, Y, and Z, where Z is a 2D array. You must manually select the polymorphic instance to use.

Note

Performs two-dimensional interpolation when X, Y, xi, and yi are 1D arrays.


icon

Inputs/Outputs

  • ci32.png method

    method sets the interpolation method.

    0nearest—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.
    1bilinear—Sets the interpolated values to points along the line segments that connect X and Y.
    2bicubic—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.
    3bicubic spline—Guarantees that the first and second partial derivatives of the cubic interpolating polynomials are continuous, even at the data points.
  • c2ddbl.png Z

    Z is the 2D array of tabulated values of the dependent variable.

  • c1ddbl.png X

    X is the 1D array of tabulated values of the first independent variable. All interpolation methods require that X be monotonic.

    If X is not empty, the length of X must equal the number of columns in Z. If X is empty, this VI treats X as [0, 1, …, N – 1], where N is the number of columns in Z.

  • c1ddbl.png Y

    Y is the 1D array of tabulated values of the second independent variable. All interpolation methods require that Y be monotonic.

    If Y is not empty, the length of Y must equal the number of rows in Z. If Y is empty, this VI treats Y as [0, 1, …, M – 1], where M is the number of rows in Z.

  • c1ddbl.png xi

    xi is the 1D array of values of the first independent variable at which interpolated values of the dependent variable zi are to be computed.

  • c1ddbl.png yi

    yi is the 1D array of values of the second independent variable at which interpolated values of the dependent variable zi are to be computed.

  • ci32.png ntimes

    ntimes determines the 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 VI ignores ntimes.

  • i2ddbl.png zi

    zi is the output 2D array of interpolated values that correspond to the xi, yi independent variable values.

  • i2ddbl.png xi used

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

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

  • i2ddbl.png yi used

    yi used is the 2D array of values of the second independent variable at which interpolated values of the dependent variable zi are computed.

    If you wire data to yi, yi used returns yi. Otherwise, yi used returns an array with columns of 2ntimes – 1 points located evenly between each two adjacent elements in Y, and the number of columns in yi used equals the number of columns in xi used.

  • ii32.png error

    error returns any error or warning from the VI. You can wire error to the Error Cluster From Error Code VI to convert the error code or warning into an error cluster.

  • This VI accepts tabulated X, Y, and Z values (two independent variables and one dependent variable, respectively) and provides interpolated values zi that correspond to each xi, yi location. The VI looks up each value of xi, yi in X, Y and uses the relative location in X, Y to find the interpolated value zi at the relative location within Z.

    This VI allows you to choose between four different interpolation methods.

    In the following illustration, xi and yi are 2D arrays that specify the coordinates to be interpolated. In other words, the coordinates of zim, n are (xim, n, yim, n), where m and n are the indices for xi, yi, and zi. X and Y are 1D arrays that specify the coordinates of Z. i and j are the indices of X and Y, respectively. Z is the 2D array that represents the corresponding dependent variable, and the red dot specifies the position of zim, n.

    Nearest Interpolation 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 previous illustration, zim, n = zi, j + 1.

    Bilinear Interpolation Method

    The bilinear method is the extension of the linear method in the Interpolate 1D VI. 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 VI 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.

    Bicubic Interpolation 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.

    Refer to Numerical Recipes in C++ in the Mathematics Related Documentation topic for more information about the bicubic interpolation method.

    Bicubic Spline Interpolation Method

    The bicubic spline method is an extension of the cubic spline method in the Interpolate 1D VI. 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.

    Refer to Numerical Recipes in C++ in the Mathematics Related Documentation topic for more information about the bicubic spline interpolation method.

    Examples

    Refer to the following example files included with LabVIEW.

    • labview\examples\Mathematics\Interpolation\2D Interpolation.vi