Admin Production ni-theme
Current Publication

EquiRpl_BSF

LabWindows/CVI

EquiRpl_BSF

Advanced Analysis Library Only

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

Purpose

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

Example Code

/* Design a 51-point bandstop 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 pass band [0, 200] */
f2 = 250.0;
f3 = 350.0; /* the stop band [250, 350] */
f4 = 400.0; /* the second pass band [400, 500] */
n = 51; /* filter length */
m = 256;
EquiRpl_BSF (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
samplingFrequency double Sampling frequency in Hertz.
f1 double Highest frequency of the lower pass band. The lower pass band is [0, f1].
f2 double Lowest frequency of the stop band. The stop band is [f2, f3].
f3 double Highest frequency of the stop band. The stop band is [f2, f3].
f4 double Lowest frequency of the upper pass band. The upper pass band is [f4, samplingFreq/2].
numberOfCoef int Length of the window FIR filter.

Valid Range: 8 to 511.
Output
Name Type Description
coefficientArray double [] Calculated output window FIR filter coefficients.
delta double 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.

Additional Information

Library: Advanced Analysis Library

Include file: analysis.h

LabWindows/CVI compatibility: LabWindows/CVI 3.1 and later