# CascadeToDirectCoef

Advanced Analysis Library Only

AnalysisLibErrType CascadeToDirectCoef (IIRFilterPtr filterInformation, double aCoefficientArray[], int numberACoefficients, double bCoefficientArray[], int numberBCoefficients);

## Purpose

Converts from the cascade IIR coefficients contained by the filterInformation structure to direct-form IIR coefficients in arrays aCoefficientArray and bCoefficientArray. These two arrays must be allocated in the same way as the old-style direct coefficient design functions, for example, Bw_Coef.

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 CascadeToDirectCoef.

For lowpass and highpass type filters, the direct coefficient arrays must equal (order + 1).

For bandpass and bandstop type filters, the direct coefficient arrays must equal (2 × order + 1).

## Parameters

Input
Name | Type | Description
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 one of the cascade IIR filter design functions.
numberACoefficients | integer | The number of coefficients in aCoefficientArray. numberACoefficients = order + 1 for low- or highpass filters numberACoefficients = 2 × order + 1 for bandpass or bandstop filters
numberBCoefficients | integer | The number of coefficients in bCoefficientArray. numberBCoefficients = order + 1 for low- or highpass filters numberBCoefficients = 2 × order + 1 for bandpass or bandstop filters
Output
Name | Type | Description
aCoefficientArray | double-precision array | Array that contains the reverse coefficients of the direct-form IIR filter.
bCoefficientArray | double-precision array | Array that contains the forward coefficients of the direct-form IIR filter.

## 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.