Table Of Contents

Interpolate 1D (G Dataflow)

    Last Modified: January 9, 2017

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


    X is monotonic

    A Boolean that specifies whether the values of the independent variable are increasing monotonically with the index.

    True Does not sort the independent variable or reorder the dependent variable.
    False Sorts the independent variable to be in ascending order and reorders the dependent variable accordingly.

    Default: False



    Interpolation method.

    Name Value Description
    nearest 0

    Chooses the Y value corresponding to the X value that is nearest to the current xi value. This node sets the interpolated value to the nearest data point.

    linear 1

    Sets the interpolated values to points along the line segments connecting the X and Y data points.

    spline 2

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

    cubic Hermite 3

    Guarantees that the first derivative of the cubic interpolating polynomials is continuous and sets the derivative at the endpoints to certain values in order to preserve the original shape and monotonicity of the Y data.

    Lagrange 4

    Uses the barycentric Lagrange interpolation algorithm.

    Choosing the Interpolation Method

    You can refer to the following facts when you choose among the five interpolation methods:

    • The nearest method and the linear method are simple to use but are too inaccurate in most applications.
    • The spline method returns the smoothest result out of all five methods.
    • The cubic Hermite method has better local property than the spline method and the Lagrange method.
    • The Lagrange method is simple to implement but not suitable for exploratory calculation. When compared to the spline method, the Lagrange method yields the interpolation result with extreme derivatives.

    The Nearest Method

    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

    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:

    L j ( x ) = y j + y j + 1 y j x j + 1 x j ( x x j )

    The Spline Method

    The spline method refers to the cubic spline method. With this method, the node derives a third-order polynomial for each interval between two adjacent points. The polynomials meet the following conditions:

    • The first and second derivatives at xj are continuous.
    • The polynomials pass all the specified data points.
    • The second derivatives at the beginning and end are zero.

    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).

    The Cubic Hermite Method

    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].

    The Lagrange Method

    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:

    y i m = j = 0 N 1 c j y j


    • c j = k = 0 , k j N 1 x i m x k x j x k
    • yim is the m-th element in yi
    • xim is the m-th element in xi

    Default: linear



    Tabulated values of the dependent variable.



    Tabulated values of the independent variable.

    The length of X must equal the length of Y.



    Locations of the interpolation points.

    This input yields interpolated values between every Y element when xi is empty. Interpolation between Y elements is repeated ntimes.The node ignores ntimes if you wire the xi input.


    error in

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

    Default: No error



    Array of values of the independent variable at which this node computes the interpolated values of the dependent variable.



    Output array of interpolated values that correspond to the independent variable values.


    xi used

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

    If xi is empty, xi used returns 2ntimes *(N - 1) + 1 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 node ignores ntimes, and xi used is the same as xi.


    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

    Recently Viewed Topics