CubicSplineFit

Advanced Analysis Library Only

AnalysisLibErrType CubicSplineFit (double arrayX[], double arrayY[], double weight[], int numberOfElements, double balance, double smoothness[], double fittedData[]);

Purpose

Uses cubic spline fitting to fit the data set (x,y). This function fits the data set (x,y) by minimizing

where is the cubic spline function, and , for

Parameters

Input
Name Type Description
arrayX double-precision array The x value of the input data set (x,y). arrayX must be in ascending order.
arrayY double-precision array The y value of the input data set (x,y). If fittedData is NULL, the best fit array overwrites arrayY.
weight double-precision array The weight of each data point. If weight is NULL, all weights are assumed to be 1.
numberOfElements integer The length of arrayX, arrayY, weight, and fittedData. numberOfElements must be greater than or equal to 2.
balance double-precision The trade-off between the smoothness of the cubic spline fit and the accuracy with which it fits the observations.
If balance = 0, the function is the linear fitting. If balance = 1, the function is the spline interpolation. If balance is out of the range [0,1], this function automatically calculates a proper value for balance.
smoothness double-precision array Controls the smoothness for each interval between two contiguous data points. The larger the smoothness, the smoother the curve. The length of smoothness must be numberOfElements - 1. If smoothness is NULL, all smoothnesses are assumed to be 1.
Output
Name Type Description
fittedData double-precision array The y values calculated using the cubic spline fitting model. If fittedData is NULL, the best fit array overwrites arrayY.

Return Value

Name Type Description
status AnalysisLibErrType A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.