Admin Production ni-theme
Current Publication

Wind_LPF

LabWindows/CVI

Wind_LPF

Advanced Analysis Library Only

AnalysisLibErrType Wind_LPF (double samplingFrequency, double cutoffFrequency, int numberOfCoef, double coefficientArray[], int windowType);

Purpose

Note Note  This function has been superseded by WindFIR_Filter.

Designs a digital lowpass FIR linear phase filter using a windowing technique. Five windows are available. Wind_LPF generates only the filter coefficients; it does not actually perform data filtering.

The attenuation value determines the approximate peak value of the sidelobes. Transition bandwidth determines a frequency range over which the filter response changes from the pass band to the stop band or from the stop band to the pass band. For more information, refer to Discrete-Time Signal Processing by Oppenheim and Schafer, cited in the Bibliography.

Example Code

/* Design a 55-point lowpass FIR linear phase filter that can achieve at least a 44 dB attenuation and filter the incoming signal with the designed filter. */
double x[256], coef[55], y[310], fs, fc;
n, m, windType;
fs = 1000.0; /* sampling frequency */
fc = 200.0; /* desired cutoff frequency */
n = 55; /* filter length */
windType = 3; /* using Hanning window */
m = 256;
Wind_LPF (fs, fc, n, coef, windType);
Convolve (coef, n, x, m, y); /* Convolve the filter with the signal. */

Parameters

Input
Name Type Description
samplingFrequency double Sampling frequency in Hertz.
cutoffFrequency double Cutoff frequency of the filter in Hertz.
numberOfCoef int Length of the window FIR filter.
windowType int Window type.

windowType selects one of the five windows as shown in the following table.

windowType Window Attenuation (dB) Transition Bandwidth (fs/n)
1 Rectangular 21 0.9
2 Triangular 25 1.18
3 Hanning 44 2.5
4 Hamming (Default) 53 3.13
5 Blackman 74 4.6
Output
Name Type Description
coefficientArray double [] Calculated output window FIR filter coefficients.

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 3.1 and later