Owning Palette: Advanced FIR Filtering VIs
Requires: Full Development System
Designs a Savitzky-Golay FIR smoothing filter. This VI returns the designed Savitzky-Golay filter coefficients and the differentiation filter coefficients.
Add to the block diagram | Find on the palette |
compute differentiation filters? specifies whether the VI calculates the Differentiation Filters. The default is TRUE. | |
side points specifies the number of data points to each side of the current data point to use for the least squares minimization. side points*2 + 1 is the length of the moving window, which must be greater than the polynomial order. | |
polynomial order specifies the order of the polynomial. | |
Weight specifies a weighting vector to use in the least squares minimization. This array must be empty or have a length of side points*2+1. | |
Savitzky-Golay Filters is an n-by-n matrix with rows representing the FIR filter coefficients where n is side points*2+1. | |
Differentiation Filters is an m-by-n matrix where the p-th row is the differentiation filter for the p-th order derivative, where m is polynomial order+1, and n is side points*2+1. This VI computes Differentiation Filters only if compute differentiation filters? is TRUE. | |
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. |
The Savitzky-Golay filter smoothes a noisy signal by the piece-by-piece fitting of a polynomial function to the signal. This VI performs the fitting by least squares minimization. The following equation shows the length of the moving polynomial fitting window.
2k+1, where k is side points,
including the current point and k points on each side of the current point.
The central row of Savitzky-Golay Filters estimates the middle point of the moving window. The other rows of Savitzky-Golay Filters smooth the endpoints of the signal, where the window length exceeds the number of remaining data points.
To smooth a signal, apply the first k rows of Savitzky-Golay Filters to the first 2k+1 points of the signal to get the first k smoothed points. Apply the last k rows of Savitzky-Golay Filters to the last 2k+1 points of the signal to get the last k smoothed points. Apply the central row of Savitzky-Golay Filters for all other points.
The following block diagram illustrates how to apply the designed Savitzky-Golay filter to a signal.
The VI also generates the differentiation filters if compute differentiation filters? is TRUE. The p-th row of Differentiation Filters is the differentiation filter of the p-th order derivative. Given a signal of length 2k+1, you can find an estimate of the p-th order derivative of its middle point using the following block diagram.
Refer to the Design and Apply Savitzky-Golay Filter VI in the labview\examples\Signal Processing\Filters directory for an example of using the Savitzky-Golay Filter Coefficients VI.