Parks_McClellanCoef
Advanced Analysis Library Only
AnalysisLibErrType Parks_McClellanCoef (int numberOfCoefficients, double samplingFrequency, BandParameter bandParameters[], ssize_t numberOfParameters, int filterType, double coefficients[], double *ripple);
Purpose
Designs a set of linear-phase FIR multiband digital filter coefficients. Parks_McClellanCoef generates only the filter coefficients; it does not actually perform data filtering. To filter a sequence X using the set of FIR filter coefficients coefficients, call ConvolveEx with X and coefficients as the input sequences. The equi-ripple filters use a similar technique to filter the data.
For more information, refer to Discrete-Time Signal Processing by Oppenheim and Schafer, cited in the Bibliography.
Example Code
/* Design a 55-point linear-phase FIR multiband digital filter using Parks-McClellan algorithm. Filter the incoming signal with the designed filter. */
Parameters
Input | ||||||||||||||
Name | Type | Description | ||||||||||||
numberOfCoefficients | int | The total number of coefficients in coefficients. A coefficient corresponds to a multiplication and an addition. If there are n coefficients, every filtered sample requires n multiplications and n additions. This value must be greater than 2. | ||||||||||||
samplingFrequency | double | Sampling frequency in Hertz. This value must be greater than zero. | ||||||||||||
bandParameters | BandParameter [] | Pointer to the band parameters structure that contains the necessary information associated with each band for the FIR design. The definition of the filter structure is as follows: typedef struct {
double amplitude; /* appropriate magnitude response, or gain, of the filter between fLow and fHigh */ amplitude—The appropriate magnitude response, or gain, of the filter between fLow and fHigh. fLow—The frequency at which the band begins. fHigh—frequency at which the band ends. wRipple—The weighted ripple error that this function minimizes. The higher the weight, the smaller the error in the band. For each band, fHigh must be greater than fLow, as shown by the following relationship. fhi < fli for i = 0, 1, 2, ..., m – 1 where fhi is the higher frequency in the ith band, fli is the lower frequency in the ith band, and m is the number of bands. For adjacent bands, the lower frequency in the higher band must be greater than the higher frequency in the adjacent lower band, as shown by the following relationship. fli < fhi – 1 for i = 1, 2, ..., m – 1 where fli is the lower frequency in the higher of the adjacent bands, fhi – 1 is the higher frequency in the lower of the adjacent bands, and m is the number of bands. The higher frequency in the last band must be equal to or less than half of samplingFrequency. |
||||||||||||
numberOfParameters | ssize_t | Size of bandParameters. | ||||||||||||
filterType | int | Filter type. filterType must be one of the following values.
|
||||||||||||
Output | ||||||||||||||
Name | Type | Description | ||||||||||||
coefficients | double [] | Array of FIR filter coefficients using the Parks-McClellan algorithm with the Remes exchange technique. | ||||||||||||
ripple | double | Optimal ripple that is a measure of deviation from the ideal filter specifications. |
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