Advanced Analysis Library Only
AnalysisLibErrType PolyFitEx (double arrayX[], double arrayY[], int numberOfElements, int order, int specCoefficientOrder[], double specCoefficients[], int numberOfSpecCoefficients, int algorithm, double fittedData[], double coefficients[], double *mse);
Fits the data set (x, y) to a polynomial model using the Least Square method. The following equation represents the polynomial model:
where a0, a1, ... , am-1 are the polynomial coefficients.
| Input | ||
| Name | Type | Description |
| arrayX | double-precision array | The x value of the data set (x, y). If fittedData is NULL, the best fit array overwrites arrayX. |
| arrayY | double-precision array | The y value of the data set (x, y). |
| numberOfElements | integer | The length of arrayX and arrayY. |
| order | integer | The order of the polynomial to which to fit the data set. order must be greater than or equal to 0. |
| specCoefficientOrder | integer array | specCoefficientOrder contains the orders on which the polynomial coefficients are constrained to be the known values specified in specCoefficients. Set specCoefficientOrder to NULL if there are no constrained coefficients. |
| specCoefficients | double-precision array | specCoefficients contains the coefficients on the orders specified in specCoefficientOrder. Set specCoefficients to NULL if there are no constrained coefficients. |
| numberOfSpecCoefficients | integer | The length of specCoefficientOrder and specCoefficients. numberOfSpecCoefficients is optional. Set numberOfSpecCoefficients to 0 if a specified order and coefficients are not available. |
| algorithm | integer | The algorithm used in polynomial fit. algorithm must be one of the following values:
|
| Output | ||
| Name | Type | Description |
| fittedData | double-precision array | The y values calculated using the polynomial model. If fittedData is NULL, the best fit array overwrites arrayX. |
| coefficients | double-precision array | The coefficients of the fitted polynomial in ascending order of power. |
| mse | double-precision | The mean square error. |
| Name | Type | Description |
| status | AnalysisLibErrType | A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants. |