# Ksr_BSF

Advanced Analysis Library Only

AnalysisLibErrType Ksr_BSF (double samplingFreq, 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

/* 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
samplingFreq | double-precision | Sampling frequency in Hertz.
lowerCutoffFreq | double-precision | Lower cutoff frequency in Hertz.
upperCutoffFreq | double-precision | Higher cutoff frequency in Hertz.
numberOfCoef | integer | Length of the window FIR filter. numberOfCoef must be odd for this filter.
beta | double-precision | 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-precision array | 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.