Interpolate 2D VI
- 已更新2025-07-30
- 閱讀時間為 3 分鐘
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.

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