Table Of Contents

Spline Fitting (Cubic) (G Dataflow)

Version:
Last Modified: January 9, 2017

Uses cubic spline fitting to smooth an input data set.

connector_pane_image
datatype_icon

y

Dependent values. y must contain at least two points.

datatype_icon

x

Independent values. x must be the same size as y. The elements of x must be in ascending order.

datatype_icon

weight

Weights for the observations.

weight must be the same size as y. weight also must contain non-zero elements. If an element in weight is less than 0, this node uses the absolute value of the element. If you do not wire an input to weight, this node sets all elements of weight to 1.

datatype_icon

smoothness

Smoothness for each interval between two contiguous data points.

The larger the smoothness, the smoother the curve. The number of elements in smoothness n - 1, where n is the length of y. If smoothness is unwired, this node sets all elements of smoothness to 1.

datatype_icon

error in

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

Default: No error

datatype_icon

balance parameter

Balance between the smoothness of the cubic spline fit and the accuracy with which it fits the observations.

balance parameter must fall within the range [0, 1]. If balance parameter is 0, the cubic spline fit is equivalent to a linear fit. If balance parameter is 1, the cubic spline fit interpolates between the data points. If balance parameter is out of the range [0, 1], this node calculates an appropriate value for balance parameter automatically according to the values of x.

How balance parameter Affects the Fit Result

The following graph shows the fit results when balance parameter takes different values, where p is balance parameter.

datatype_icon

best cubic spline fit

Y-values of the fitted model.

datatype_icon

error out

Error information. The node produces this output according to standard error behavior.

Algorithm Definition for Cubic Spline Fitting

This node fits the observations (x, y) by minimizing the following function:

p i = 1 n 1 w i ( y i f ( x i ) ) 2 + ( 1 p ) x 0 x n 1 λ ( x ) ( f " ( x ) ) 2 x

where

  • p is balance parameter
  • wi is the ith element of weight
  • yi is the ith element of y
  • xi is the ith element of x
  • f''(x) is the second-order derivative of the cubic spline function, f(x)
  • λ ( x ) is the piecewise constant function λ ( x ) = λ i , x i x < x i + 1 , for i = 0, 1, ..., n - 2
  • λ i is the ith element of smoothness

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported


Recently Viewed Topics