Filters a series with an IIR digital filter
in the time domain where the filter coefficients are represented in cascaded
CASCADE(series, iircoef)
(y, zf) = CASCADE(series, iircoef, zi)
series |
- |
A series, the input data to filter. |
iircoef |
- |
A series, the IIR coefficients in 2nd order cascade form. |
zi |
- |
Optional. A series, the initial conditions. |
A filtered series.
(y, zf) = CASCADE(series, iircoef, zi) returns the filtered series and final conditions.
W1: butterworth(1, 100.0, 10)
W2: gsin(100, 1/100, 4.0) + gsin(100, 1/100, 40.0)
W3: cascade(w2, w1)
W1 contains a 10 Hz lowpass Butterworth filter. W2 contains the sum of a 4 Hz and 40 Hz sine wave. W3 removes the 40 Hz component by applying the cascade IIR filter coefficients.
W1: butterworth(1, 100.0, 10)
W2: gsin(200, 1/100, 4.0) + gsin(200, 1/100, 40.0)
W3: extract(w2, 1, 100)
W4: extract(w2, 101, -1)
W5: (y, zf) = cascade(w3, w1);y
W6: cascade(w4, w1, zf)
W7: concat(w5, w6)
W8: cascade(w2, w1)
W9: w7 - w8
W1 contains a 10 Hz lowpass Butterworth filter.
W2 contains 200 samples of the sum of a 4 Hz and 40 Hz sine wave.
W3 and W4 split the input series into two sections.
W5 and W6 filter each section where the final conditions of the first section are used as the initial conditions of the second section.
W7 combines the filtered sections and W8 filters the original data in one step.
W9 shows the data filtered in sections is identical to the unsectioned filtered data.
An Infinite Impulse Response (IIR) filter can be implemented with the following difference equation:
where y[n] is the
output data, x[n] the input
and
The equivalent
To minimize round-off error, enhance stability
and provide a system more resistant to coefficient quantization noise,
CASCADE implements the filter in terms of cascaded
or equivalently:
where G is the system gain, bk and ak are the filter coefficients for the kth stage.
CASCADE realizes each biquad stage using the Transposed Direct Form II (TDF-II) structure depicted below:
Though the overall mathematical transfer function remains unchanged, this structure places the zeros before the poles in the signal path. As a result, the feedforward zeros compensate for the potentially large gain produced by the recursive poles early in the processing chain. This keeps the magnitudes of the internal state variables much closer to the overall filter gain, dramatically reducing the risk of large intermediate values that could cause overflow, loss of precision, or numerical instability.
To implement the Transposed Direct Form II structure, CASCADE expects the filter coefficients of input parameter iircoef to be provided in the following order:
{G, b10, b11, b12, a11, a12, b20, b21, b22, a21, a22, ... , bN0, bN1, bN2, aN1, aN2}
This coefficient form is produced by the BESSEL, BUTTERWORTH, CHEBY1, CHEBY2 and ELLIPTIC IIR filters design functions provided by DADiSP/Filters.
See SOSFILT to process a filter implemented with coefficients in second order section form. Note the series and filter coefficient input arguments are reversed for SOSFILT and CASCADE.
See FILTEQ to process a filter implemented as a standard difference equation.
[1] |
Oppenheim and Schafer |
|
Digital Signal Processing |
|
Prentice Hall, 1975 |
[2] |
Digital Signal Processing Committee |
|
Programs for Digital Signal Processing |
|
I.E.E.E. Press, 1979 |