Ksr_BSF
Advanced Analysis Library Only
AnalysisLibErrType Ksr_BSF (double samplingFrequency, double lowerCutoffFreq, double upperCutoffFreq, int numberOfCoef, double coefficientArray[], double beta);
Purpose
Designs a digital bandstop FIR linear phase filter using a Kaiser window. Ksr_BSF 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 bandstop 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 */
/* stop band is from 200.0 to 300.0 */
n = 55; /* filter length */
beta = 3;
m = 256;
Ksr_BSF (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 | Higher cutoff frequency in Hertz. | ||||||||||||
numberOfCoef | int | Length of the window FIR filter. numberOfCoef must be odd for this 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.
|
||||||||||||
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