EquiRpl_LPF
Advanced Analysis Library Only
AnalysisLibErrType EquiRpl_LPF (double samplingFrequency, double f1, double f2, int numberOfCoef, double coefficientArray[], double *delta);
Purpose
Designs an optimal lowpass FIR linear phase filter using the Parks-McClellan algorithm. EquiRpl_LPF is a simplified case of Equi_Ripple function. EquiRpl_LPF generates only the filter coefficients; it does not actually perform data filtering.
Example Code
/* Design a 25-point lowpass filter and filter the incoming signal. */
double x[256], coef[25], y[281], fs, f1, f2, delta;
int n, m;
fs = 1000.0; /* sampling frequency */
f1 = 300.0; /* the pass band [0, 300] */
f2 = 400.0; /* the stop band [400, 500] */
n = 25; /* filter length */
m = 256;
EquiRpl_LPF (fs, f1, f2, 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 pass band. The pass band is [0, f1]. |
f2 | double | Lowest frequency of the stop band. The stop band is [f2, 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