Admin Production ni-theme
Current Publication

EquiRpl_BSFiltering

LabWindows/CVI

EquiRpl_BSFiltering

Advanced Analysis Library Only

AnalysisLibErrType EquiRpl_BSFiltering (double inputArray[], ssize_t numberOfElements, int numberOfCoeffs, double samplingFrequency, double f1, double f2, double f3, double f4, double outputArray[]);

Purpose

Filter the real array using a optimal bandstop FIR linear phase filter with equi-ripple characteristics.

Example Code

/* Design a 51-point bandstop FIR filter and filter the real incoming signal. */
double x[256], y[306];
double fs, f1, f2, f3, f4;
int n, ncoef;

fs = 1000.0; // sampling frequency
f1 = 200.0; // first pass band [0, 200]
f2 = 250.0; // stop band [250, 350]
f3 = 350.0;
f4 = 400.0; // second pass band [400, fs/2]
n = 256; // input signal length
ncoef = 51; //filter length
WhiteNoise (n, 1, 17, x);

EquiRpl_BSFiltering(x, n, ncoef, fs, f1, f2, f3, f4, y);

Parameters

Input
Name Type Description
inputArray double [] Array containing the raw data to filter.
numberOfElements ssize_t Number of elements in the input array inputArray.
numberOfCoeffs int Length of the FIR filter. numberOfCoeffs must be greater than 2.

The algorithm introduces a large error when designing a bandstop filter for an even number of ncoef. To avoid this error, the EquiRpl_BSFiltering adjusts the ncoef to the next higher odd value if ncoef is even.
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].
highestStopFreq double Highest frequency of the stop band. The stop band is [f2, f3].
lowestPassFreq double Lowest frequency of the upper pass band. The upper pass band is [f4, samplingFreq/2].
Output
Name Type Description
outputArray double [] Filtered data. This array must be at least (n + ncoef - 1) elements long when ncoef is odd. This array must be at least (n + ncoef) elements long when ncoef is even.

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 2012 and later