Table Of Contents

Interpolate 1D (Spline) (G Dataflow)

Last Modified: January 12, 2018

Performs one-dimensional interpolation by using the spline interpolation method.

The spline interpolation method returns the smoothest result out of all interpolation methods.

Programming Patterns

You can reuse piecewise polynomial as an input to the Evaluate Interpolating Polynomial node to find the interpolated values.

connector_pane_image
datatype_icon

x is monotonic?

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

True The values of the independent variable increase monotonically with the index. This node does not sort x or reorder y.
False The values of the independent variable does not increase monotonically with the index. This node sorts x to be in ascending order and reorders y accordingly.

Default: False

datatype_icon

y

Tabulated values of the dependent variable.

datatype_icon

x

Tabulated values of the independent variable. The length of x must equal the length of y.

datatype_icon

xi

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

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

datatype_icon

ntimes

Number of times that this node interpolates values repeatedly and evenly between each x element to generate xi used. ntimes determines the locations of the interpolation values.

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

This input is available only if you wire an array of double-precision, floating-point numbers to xi.

Default: 1

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

initial boundary

Conditions at the initial boundary.

datatype_icon

boundary

Boundary condition type.

Name Description
natural spline The second derivative at the initial boundary is 0 and this node ignores the derivative value input in initial boundary.
not-a-knot The third derivative at the second data point x1 in x is continuous, which means this node fits one polynomial through the first three data points, and the polynomial between [x0, x1] is the same as the polynomial between [x1, x2]. This option is useful if you know nothing about the derivatives at the initial boundary. If you specify not-a-knot, this node ignores the derivative value input in initial boundary.
1st derivative derivative value in initial boundary specifies the first derivative at the initial boundary.
2nd derivative derivative value in initial boundary specifies the second derivative at the initial boundary.

Default: natural spline

datatype_icon

derivative value

Value of the first or second derivative at the initial boundary.

This node ignores derivative value when boundary is natural spline or not-a-knot.

Default: 0

datatype_icon

final boundary

Conditions at the final boundary.

datatype_icon

boundary

Boundary condition type.

Name Description
natural spline The second derivative at the final boundary is 0 and this node ignores the derivative value input in final boundary.
not-a-knot The third derivative at the second-to-last data point in x, xn - 2, is continuous, which means this node fits one polynomial through the last three data points, and the polynomial between [xn - 2, xn - 1] is the same as the polynomial between [xn - 3, xn - 2]. This option is useful if you know nothing about the derivatives at the final boundary. If you specify not-a-knot, this node ignores the derivative value input in final boundary.
1st derivative derivative value in final boundary specifies the first derivative at the final boundary.
2nd derivative derivative value in final boundary specifies the second derivative at the final boundary.

Default: natural spline

datatype_icon

derivative value

Value of the first or second derivative at the final boundary.

This node ignores derivative value when boundary is natural spline or not-a-knot.

Default: 0

datatype_icon

yi

Interpolated values that correspond to the independent variable values.

This output can return a double-precision, floating-point number or a 1D array of double-precision, floating-point numbers.

datatype_icon

xi used

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

This output is available only if you wire an array of double-precision, floating-point numbers to xi.

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, xi used equals xi.

datatype_icon

piecewise polynomial

Piecewise interpolating polynomial for the Evaluate Interpolating Polynomial node to reuse.

datatype_icon

x locations

Endpoint values of the x domain.

If x locations is of size N, the coefficients array should contain N - 1 rows of polynomial coefficients.

datatype_icon

coefficients

Coefficients of the interpolating polynomial.

Row i of coefficients contains the coefficients for the interpolating polynomial between elements xi and xi + 1 of x locations.

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.

Understanding the Spline Interpolation Method

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

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

The following figure illustrates the cubic spline method.

In the previous figure, Pj(x) is the third-order polynomial between two adjacent points, (xj, yj) and (xj + 1, yj + 1).

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported

Web Server: Not supported in VIs that run in a web application


Recently Viewed Topics