# EquiRpl_BPF

Advanced Analysis Library Only

AnalysisLibErrType EquiRpl_BPF (double samplingFreq, double f1, double f2, double f3, double f4, int numberOfCoef, double coefficientArray[], double *delta);

## Purpose

Designs an optimal bandpass FIR linear phase filter using the Parks-McClellan algorithm. EquiRpl_BPF is a simplified case of the Equi_Ripple function. EquiRpl_BPF generates only the filter coefficients; it does not actually perform data filtering.

### Example

/* Design a 51-point bandpass filter and filter the incoming signal. */
double x[256], coef[25], y[301], fs, f1, f2, f3, f4, delta;
int n, m;
fs = 1000.0; /* sampling frequency */
f1 = 200.0; /* the first stop band [0, 200] */
f2 = 250.0;
f3 = 350.0; /* the pass band [250, 350] */
f4 = 400.0; /* the second stop band [400, 500] */
n = 51; /* filter length */
m = 256;
EquiRpl_BPF (fs, f1, f2, f3, f4, n, coef, &delta);
Convolve (coef, n, x, m, y); /* Convolve the filter with the signal. */

## Parameters

Input
Name | Type | Description
samplingFreq | double-precision | Sampling frequency in Hertz.
f1 | double-precision | Highest frequency of the lower stop band. The lower stop band is [0, f1].
f2 | double-precision | Lowest frequency of the pass band. The pass band is [f2, f3].
f3 | double-precision | Highest frequency of the pass band. The pass band is [f2, f3].
f4 | double-precision | Lowest frequency of the upper stop band. The upper stop band is [f4, samplingFreq/2].
numberOfCoef | integer | length of the window FIR filter. Valid Range: 8 to 511.
Output
Name | Type | Description
coefficientArray | double-precision array | Calculated output window FIR filter coefficients.
delta | double-precision | Calculated normalized absolute ripple size. To obtain the amplitude of the passband ripple in decibels, use the following formula: 20*log(1+Delta) To obtain the attenuation of the stopband in decibels, use the following formula: 20*log(Delta)

## 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.