Table Of Contents

Spline Interpolant (G Dataflow)

Version:
    Last Modified: March 15, 2017

    Returns an array of length n, which contains the second derivatives of the spline interpolating function g(x) at the tabulated points xi, where i = 0, 1, ..., n - 1.

    Programming Patterns

    You can use interpolant as an input to the Spline Interpolation node to interpolate y at any value of x 0 x x n 1 .

    connector_pane_image
    datatype_icon

    reset

    A Boolean that specifies whether to reset the internal state of the node.

    True Resets the internal state of the node.
    False Does not reset the internal state of the node.

    This input is available only if you wire a double-precision, floating-point number to x or y.

    Default: False

    datatype_icon

    y

    Dependent value.

    This input accepts a double-precision, floating-point number or a 1D array of double-precision, floating-point numbers.

    When x and y are 1D arrays of double-precision, floating-point numbers, if the number of elements in x is different from the number of elements in y, this node sets the output interpolant to an empty array and returns an error.

    datatype_icon

    x

    Independent value.

    This input accepts a double-precision, floating-point number or a 1D array of double-precision, floating-point numbers.

    When x and y are 1D arrays of double-precision, floating-point numbers, if the number of elements in x is different from the number of elements in y, this node sets the output interpolant to an empty array and returns an error.

    datatype_icon

    initial boundary

    The first derivative of interpolating function g(x) at x0, g'(x0).

    Default: 1E+30, which causes this node to set the initial boundary condition for a natural spline.

    datatype_icon

    final boundary

    The first derivative of interpolating function g(x) at xn - 1, g'(xn - 1).

    Default: 1E+30, which causes this node to set the final boundary condition for a natural spline.

    datatype_icon

    error in

    Error conditions that occur before this node runs.

    The node responds to this input according to standard error behavior.

    Standard Error Behavior

    Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

    error in does not contain an error error in contains an error
    If no error occurred before the node runs, the node begins execution normally.

    If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

    If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

    Default: No error

    datatype_icon

    sample length

    Length of each set of data. The node performs computation for each set of data.

    sample length must be greater than zero.

    This input is available only if you wire a double-precision, floating-point number to x or y.

    Default: 100

    datatype_icon

    interpolant

    The second derivative of interpolating function g(x) at points xi, i = 0, 1, ..., n - 1.

    datatype_icon

    error out

    Error information.

    The node produces this output according to standard error behavior.

    Standard Error Behavior

    Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

    error in does not contain an error error in contains an error
    If no error occurred before the node runs, the node begins execution normally.

    If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

    If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

    Algorithm for Calculating the Interpolant

    Input arrays x and y are of length n and contain a tabulated function where x0 < x1 < ... < xn-1, as shown in the following equation:

    f(xi) = yi

    The interpolating function g(x) is a piecewise function in the following equation:

    g ( x ) = { p 0 ( x ) x 0 x x 1 p n 2 ( x ) x n 2 x x n 1

    The function pi(x) is a third-order polynomial that must satisfy the following conditions:

    1. g(xi) = yi = pi(xi)
    2. g(xi) = yi = pi-1(xi)
    3. The first and second derivatives, where i = 1, …, n - 2, at each interior xi is continuous:
      1. g'(xi) = p'i(xi) = p'i-1(xi)
      2. g''(xi) = p''i(xi) = p''i-1(xi)

    With the third condition, you can derive the following equation:

    x i x i 1 6 g ( x i 1 ) + x i + 1 x i 1 3 g . ( x i ) + x i + 1 x i 6 g ( x i + 1 ) = y i + 1 y i x i + 1 x i y i y i 1 x i x i 1

    where i = 1, ..., n - 2. According to this equation, n - 2 linear equations exist for n unknown g"(xi).

    This node computes two equations for the derivatives at xo and xn-1 in the following equation:

    g ( x ) = y k + 1 y k x k + 1 x k 3 A 2 1 6 ( x k + 1 x k ) g ( x k ) + 3 B 2 1 6 ( x k + 1 x k ) g ( x k + 1 )

    Consider the following equations:

    A = x k + 1 x x k + 1 x k
    B = 1 A = x x k x k + 1 x k

    The initial boundary is the equation

    g ( x 0 ) = g ( x ) | k = 0 , x = x 0

    and the final boundary is the equation

    g ( x n 1 ) = g ( x ) | k = n 2 , x = x n 1

    For these equations, initial boundary and final boundary are the first derivative of g(x) at points x0 and xn - 1, respectively. If initial boundary and final boundary are equal to or greater than 1030, this node sets the corresponding boundary condition for a natural spline, with no second derivatives on the boundary.

    This node solves g"(xi) from n equations when i = 0, 1, …, n - 1. g"(xi) is the interpolant output.

    Where This Node Can Run:

    Desktop OS: Windows

    FPGA: This product does not support FPGA devices


    Recently Viewed Topics