# DSP Tricks: Doing Zero-phase filtering

December 01, 2009

You can cancel the nonlinear phase effects of an IIR filter by following the process shown in Figure 13-31(a) below. The y(n) output will be a filtered version of x(n) with no filter-induced phase distortion.

 Figure 13-31. Two equivalent zero-phase filtering techniques.

The same IIR filter is used twice in this scheme, and the time reversal step is a straight left-right flipping of a time-domain sequence.

Consider the following. If some spectral component in x(n) has an arbitrary phase of α degrees, and the first filter induces a phase shift of - β degrees, that spectral component's phase at node A will be α - β degrees. The first time reversal step will conjugate that phase and induce an additional phase shift of - θ degrees.

Consequently, the component's phase at node B will be - α + β - θ degrees. The second filter's phase shift of - β degrees yields a phase of - α - θ degrees at node C.

The final time reversal step (often omitted in literary descriptions of this zero-phase filtering process) will conjugate that phase and again induce an additional phase shift of - θ degrees. Thankfully, the spectral component's phase in y(n) will be α + θ - θ = α degrees, the same phase as in x(n). This property yields an overall filter whose phase response is zero degrees over the entire frequency range.

An equivalent zero-phase filter is presented in Figure 13-31(b) above. Of course, these methods of zero-phase filtering cannot be performed in real time because we can't reverse the flow of time (at least not in our universe).

This filtering is a block processing, or off-line process, such as filtering an audio sound file on a computer. We must have all the time samples available before we start processing. The initial time reversal in Figure 13-31(b) above illustrates this restriction.

There will be filter transient effects at the beginning and end of the filtered sequences. If transient effects are bothersome in a given application, consider discarding L samples from the beginning and end of the final y(n) time sequence, where L is 4 (or 5) times the order of the IIR filter.

By the way, the final peak-to-peak passband ripple (in dB) of this zero phase filtering process will be twice the peak-to-peak passband ripple of the single IIR filter. The final stop band attenuation will also be double that of the single filter.

Used with the permission of the publisher, Prentice Hall, this on-going series of articles is based on copyrighted material from "Understanding Digital Signal Processing, Second Edition" by Richard G. Lyons. The book can be purchased on line.

Richard Lyons is a consulting systems engineer and lecturer with Besser Associates. As a lecturer with Besser and an instructor for the University of California Santa Cruz Extension, Lyons has delivered digital signal processing seminars and training course at technical conferences as well at companies such as Motorola, Freescale, Lockheed Martin, Texas Instruments, Conexant, Northrop Grumman, Lucent, Nokia, Qualcomm, Honeywell, National Semiconductor, General Dynamics and Infinion.

• 08.14.2019

• 08.03.2019

• 02.17.2015

• 07.29.2019

• 08.06.2018