Owning Palette: Interpolation & Extrapolation VIs
Requires: Full Development System
Performs one-dimensional interpolation using a selected method based on the lookup table defined by X and Y.
Add to the block diagram | Find on the palette |
method specifies the interpolation method.
|
|||||||||||
Y specifies the array of tabulated values of the dependent variable. | |||||||||||
X specifies the array of tabulated values of the independent variable. The length of X must equal the length of Y. | |||||||||||
xi specifies the array of values of the independent variable at which LabVIEW computes the interpolated values yi of the dependent variable. | |||||||||||
X is monotonic specifies whether the values in X are increasing monotonically with the index. If X is monotonic is TRUE, the interpolation algorithm can avoid sorting X and reordering Y accordingly. If X is monotonic is FALSE, this VI sorts the X input arrays to be in ascending order and then reorders Y accordingly. | |||||||||||
ntimes determines the interpolation xi locations, yielding interpolated values between every Y element when xi is empty. Interpolation between Y elements is repeated ntimes. The VI ignores ntimes if you wire the xi input. | |||||||||||
yi returns the output array of interpolated values that correspond to the xi independent variable values. | |||||||||||
xi used is the 1D array of values of the independent variable at which interpolated values of the dependent variable yi are computed. If xi is empty, xi used returns (2ntimes – 1)*(N – 1) + N points with (2ntimes – 1) points located evenly between each two adjacent elements in X, where N is the length of X. If you wire the xi input, this VI ignores ntimes, and xi used is the same as xi. |
|||||||||||
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. |
The VI accepts tabulated dependent and independent variable values Y and X and provides interpolated values yi corresponding to each xi location. The VI finds each value of xi in X and uses the relative location in X to find the interpolated value yi at the same relative location in Y.
Interpolate 1D VI allows you to choose between five different interpolation methods. The following sections contain more information about each of these methods. As you read these sections, consider the following situation:
The nearest method finds the point nearest to xi in X and then assigns the corresponding y value in Y to yi, as shown in the following graph.
The linear method interpolates yi on the line segment that connects the two points (xj, xj + 1) when xi is located between the two points (xj, xj + 1) in X, as shown in the following graph.
In the previous graph, the following equation is true:
The spline method refers to the cubic spline method. With this method, the VI derives a third-order polynomial for each interval between two adjacent points. The polynomials meet the following conditions:
The following graph illustrates the cubic spline method.
In the previous graph, Pj(x) is the third-order polynomial between two adjacent points, (xj, yj) and (xj + 1, yj + 1).
Refer to A Practical Guide to Splines in the Mathematics Related Documentation topic for more information about the cubic spline method.
Note If you choose the spline method, this VI returns the same results as the Spline Interpolation 1D VI with natural spline boundary conditions. |
The cubic Hermitian spline method is the piecewise cubic Hermitian interpolation. This method derives a third-order polynomial in Hermitian form for each interval and ensures only the first derivatives of the interpolation polynomials are continuous. Compared to the cubic spline method, the cubic Hermitian method has better local property. In other words, if you change one data point xj, the effect on the interpolation result lies in the range between [xj – 1, xj] and [xj, xj + 1].
Refer to A Practical Guide to Splines in the Mathematics Related Documentation topic for more information about the cubic Hermitian method.
Note If you choose the cubic Hermite method, this VI returns the same results as the Hermite Interpolation 1D VI. |
The Lagrange method derives a polynomial of order N – 1 that passes all the N points specified in X and Y, where N is the length of X and Y. This method is a reformulation of the Newton polynomial that avoids the computation of divided differences. The following equation defines the Lagrange method:
, where
When you choose between the five interpolation methods in this VI, the following tips might be useful:
Refer to the 1D Interpolation VI in the labview\examples\Mathematics\Interpolation directory for an example of using the Interpolate 1D VI.