Admin Production ni-theme
Current Publication

Bessel_CascadeCoefEx

LabWindows/CVI

Bessel_CascadeCoefEx

Advanced Analysis Library Only

AnalysisLibErrType Bessel_CascadeCoefEx (double samplingFrequency, double lowerCutoffFreq, double upperCutoffFreq, IIRFilterPtr filterInformation);

Purpose

Generates the set of cascade form filter coefficients to implement an IIR filter as specified by the Bessel filter model. National Instruments recommends that you use this function instead of Bessel_CascadeCoef.

filterInformation is the pointer to the filter structure that contains the filter coefficients and the internal filter information. You must allocate this structure by calling AllocIIRFilterPtr before calling this cascade IIR filter design function.

To redesign another filter, first call FreeIIRFilterPtr to free the present filter structure and then call AllocIIRFilterPtr with the new type and order parameters before you call Bessel_CascadeCoefEx.

If the type and order remain the same, you can call Bessel_CascadeCoefEx without calling FreeIIRFilterPtr and AllocIIRFilterPtr. In this case, you must properly reset the filtering operation for that structure by calling ResetIIRFilter before the first call to IIRCascadeFiltering.

Example Code

/* Design a cascade lowpass Bessel IIR filter. */
double fs, fl, fh, x[256], y[256];
int type, order;
ssize_t n;
IIRFilterPtr filterInfo;
n = 256;
fs = 1000.0;
fl = 200.0;
order = 5;
type = 0;            /* lowpass */
Uniform(n, 17, x);
filterInfo = AllocIIRFilterPtr(type, order);
if(filterInfo!=0) {

Bessel_CascadeCoefEx(fs, fl, fh, filterInfo);
IIRCascadeFiltering(x, n, filterInfo, y);
FreeIIRFilterPtr(filterInfo);

}

Parameters

Input
Name Type Description
samplingFrequency double The frequency in Hertz at which you want to sample x. This value must be greater than 0.
lowerCutoffFreq double The lower cutoff frequency of the filter in Hertz. This value must be 0 < lowerCutoffFreq < upperCutoffFreq < 0.5 * samplingFrequency.
upperCutoffFreq double The upper cutoff frequency of the filter in Hertz. This value must be 0 < lowerCutoffFreq < upperCutoffFreq < 0.5 * samplingFrequency.
filterInformation IIRFilterPtr Pointer to the filter structure that contains the filter coefficients and the internal filter information.

You must allocate this structure by calling AllocIIRFilterPtr before calling this cascade IIR filter design function.

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