SavitzkyGolayCoef
Advanced Analysis Library Only
AnalysisLibErrType SavitzkyGolayCoef (int polynomialOrder, int nSidePoints, double weightingVector[], int computeDiffFilters, double filterCoefficients[], double differentiationCoefficients[]);
Purpose
Designs a Savitzky-Golay smoothing FIR filter.A polynomial (Savitzky-Golay) filter can be considered as a piece-by-piece fitting of a polynomial function to the signal. The fitting is done by a least squares (LS) estimate between the matrix and the
vector:
where is the Vandermond matrix. If the polynomial order is
, and the frame size is
(that is, the number of data points used in each polynomial least squares fitting), then:
is the weighting matrix,
,
is the weight associated with each data points
.
is the polynomial coefficients:
The polynomial model is the following:
Use the fitted value as the smoothing estimation of the original raw data
.
Parameters
Input | ||
Name | Type | Description |
polynomialOrder | int | The polynomial order. |
nSidePoints | int | (2*nSidePoints +1) is frameSize, which specifies how many data points to use in the polynomial fitting. frameSize must be greater than polynomialOrder. |
weightingVector | double [] | A weighting vector with length frameSize used in the least square polynomial fitting. If weightingVector is NULL, the function assumes all points have the equal weight. |
computeDiffFilters | int | Determines whether to compute the differentiation filters. Specify a nonzero value or ANALYSIS_TRUE or select Yes in the function panel to obtain the differentiation filters. This is the default value. Otherwise, specify 0 or ANALYSIS_FALSE or select No in the function panel. |
Output | ||
Name | Type | Description |
filterCoefficients | double [] | The designed filter coefficients, a frameSize-by-frameSize matrix. The first (frameSize-1)/2 rows are applied to the signal during the terminal transient. The last (fameSize-1)/2 rows are applied to the signal during the startup transient. The center row is applied to the steady state. |
differentiationCoefficients | double [] | The differentiation filters, with size (polyOrder+1)-by-frameSize. The p-th row is for the p-th order derivative. If diffCoef is NULL, the differentiation filters are not computed. |
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.1 and later