B-Spline Fit VI

Owning Palette: Fitting VIs

Requires: Full Development System

Uses B-spline fitting to smooth a data set.

Details  Example

Use the pull-down menu to select an instance of this VI.

 Add to the block diagram  Find on the palette

1D B-Spline Fit

# of control points specifies the number of control points that fit to the data set. # of control points must be greater than degree. The default is 10.
Y is the array of dependent values. Y must contain at least two points.
X is the array of independent values. X must be the same size as Y.
Weight is the array of weights for the observations (X, Y). Weight must be the same size as Y. Weight also must contain non-zero elements. If an element in Weight is less than 0, the VI uses the absolute value of the element.

If you do not wire an input to Weight, the VI sets all elements of Weight to 1.
degree specifies the order of polynomials that form the B-spline curve and fit to the data set. The default value is 3.
parameter selection specifies the method that computes the interim knot vector.

0equally spaced
1chord length
2centripetal (default)
Best BSpline Fit Y returns the y-values of the B-Spline curve that best fit the input data set (X, Y).
Best BSpline Fit X returns the x-values of the B-Spline curve that best fit the input data set (X, Y).
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.
residue returns the weighted mean square error of the fitted model.

nD B-Spline Fit

# of control points specifies the number of control points that fit to the data set. # of control points must be greater than degree. The default is 10.
Data specifies the multi-dimension value to fit in rows.
Weight is the array of weights for the input data. Weight must be the same size as the number of rows in Data. Weight also must contain non-zero elements. If an element in Weight is less than 0, the VI uses the absolute value of the element.

If you do not wire an input to Weight, the VI sets all elements of Weight to 1.
degree specifies the order of polynomials that form the B-spline curve and fit to the data set. The default value is 3.
parameter selection specifies the method that computes the interim knot vector.

0equally spaced
1chord length
2centripetal (default)
Best BSpline Fit returns the B-Spline curve that best fits the input Data in rows.
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.
residue returns the weighted mean square error of the fitted model.

B-Spline Fit Details

1D B-Spline Fit VI

The 1D B-Spline Fit VI calculates Best BSpline Fit X and Best BSpline Fit Y by minimizing the residue according to the following equation:

where N is the length of Y, wi is the ith element of Weight, (xi,yi) is the ith pair of the input sequences (X, Y), (x'i,y'i) is the ith pair of (Best BSpline Fit X, Best BSpline Fit Y), and the norm symbols (||) on both sides of the function compute the l2 norm of a vector. The standard B-Spline basis functions construct the B-Spline curve (x'i,y'i).

The following illustration shows a typical B-Spline Fit result.

nD B-Spline Fit VI

The nD B-Spline Fit VI calculates the Best BSpline Fit by minimizing the residue according to the following equation:

where Di is the ith row of Data and D'i is the ith row of Best BSpline Fit.

Example

Refer to the B Spline Fitting Demo VI in the labview\examples\Mathematics\Fitting directory for an example of using the B-Spline Fit VI.

 Open example  Find related examples