CubicSplineFit
- Updated2023-02-21
- 2 minute(s) read
Advanced Analysis Library Only
AnalysisLibErrType CubicSplineFit (double arrayX[], double arrayY[], double weight[], ssize_t 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 [] | The x value of the input data set (x,y). arrayX must be in ascending order. |
arrayY | double [] | The y value of the input data set (x,y). If fittedData is NULL, the best fit array overwrites arrayY. |
weight | double [] | The weight of each data point. If weight is NULL, all weights are assumed to be 1. |
numberOfElements | ssize_t | The length of arrayX, arrayY, weight, and fittedData. numberOfElements must be greater than or equal to 2. |
balance | double | 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 [] | 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 [] | 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. |
Additional Information
Library: Advanced Analysis Library
Include file: analysis.h
LabWindows/CVI compatibility: LabWindows/CVI 8.0 and later