Admin Production ni-theme
Current Publication

Ksr_BPF

LabWindows/CVI

Ksr_BPF

Advanced Analysis Library Only

AnalysisLibErrType Ksr_BPF (double samplingFrequency, double lowerCutoffFreq, double upperCutoffFreq, int numberOfCoef, double coefficientArray[], double beta);

Purpose

Designs a digital bandpass FIR linear phase filter using a Kaiser window. Ksr_BPF generates only the filter coefficients; it does not actually perform data filtering.

For more information, refer to Discrete-Time Signal Processing by Oppenheim and Schafer, cited in the Bibliography.

Example Code

/* Design a 55-point bandpass FIR linear phase filter using a Kaiser window with beta = 4.5. Filter the incoming signal with the designed filter. */
double x[256], coef[55], y[310], fs, fl, fh, beta;
n, m;
fs = 1000.0; /* sampling frequency */
fl = 200.0; /* desired lower cutoff frequency */
fh = 300.0; /* desired higher cutoff frequency */
/* pass band is from 200.0 to 300.0 */
n = 55; /* filter length */
beta = 3;
m = 256;
Ksr_BPF (fs, fl, fh, n, coef, beta);
Convolve (coef, n, x, m, y); /* Convolve the filter with the signal. */

Parameters

Input
Name Type Description
samplingFrequency double Sampling frequency in Hertz.
lowerCutoffFreq double Lower cutoff frequency in Hertz.
upperCutoffFreq double Upper cutoff frequency in Hertz.
numberOfCoef int Length of the window FIR filter.
beta double The window shape used in the Kaiser window function. A larger beta results a narrower window.

The following table lists some beta values and their equivalent windows.

beta Window
0.00 Rectangular
1.33 Triangle
3.86 Hanning
4.86 (Default) Hamming
7.04 Blackman
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