Filters Preserving Phase
In this chapter,
linear phase and
zero phase filters are
defined and discussed.

A
linear-phase filter is typically used when a
causal
filter is needed to modify a
signal's
magnitude-spectrum while
preserving the signal's time-domain waveform as much as possible.
Linear-phase filters have a
symmetric impulse response,
e.g.,
The symmetric-impulse-response constraint means
that
linear-phase filters must be FIR filters, because a causal
recursive filter cannot have a symmetric impulse
response.
We will show that every real symmetric impulse response corresponds to
a
real frequency response times a
linear phase term

, where

is the
slope of the linear phase. Linear phase is
often ideal because a filter phase of the form

corresponds to
phase delay
and
group delay
That is, both the phase and group delay of a linear-phase filter are
equal to

samples of plain delay
at every frequency.
Since a length

FIR filter implements

samples of delay, the
value

is exactly half the total filter delay. Delaying
all frequency components by the same amount
preserves
the waveshape as much as possible for a given
amplitude response.
A
zero-phase filter is a special case of a
linear-phase filter
in which the phase slope is

. The real
impulse response

of a zero-phase filter is
even.
11.1 That is, it satisfies
Note that every even
signal is symmetric, but not every symmetric
signal is even. To be even, it must be symmetric about time 0.
A
zero-phase filter cannot be causal (except in the trivial
case when the filter is a constant scale factor

).
However, in many ``off-line'' applications, such as when filtering a
sound file on a computer disk, causality is not a requirement, and
zero-phase filters are often preferred.
It is a well known
Fourier symmetry that
real, even signals have
real, even Fourier transforms [
84]. Therefore,
This follows immediately from writing
the
DTFT of

in terms of a cosine and sine transform:

DTFT
Since

is even, cosine is even, and sine is odd; and since even
times even is even, and even times odd is odd; and since the sum over
an
odd function is zero, we have that
for any real, even impulse-response

. Thus, the
frequency response

is a real,
even function of

.
A real frequency response has phase zero when it is positive, and
phase

when it is negative. Therefore, we define
a
zero-phase filter as follows:
Recall from §
7.5.2 that a
passband is defined as a
frequency band that is ``passed'' by the filter,
i.e., the filter is
not designed to minimize signal amplitude in the band. For example,
in a
lowpass filter with cut-off frequency

rad/s, the
passband is
![$ \omega\in[-\omega_c,\omega_c]$](http://www.dsprelated.com/josimages_new/filters/img1181.png)
.
Under our definition, a
zero-phase filter always has a real, even
impulse response [

], but not every real, even,
impulse
response is a
zero-phase filter. For example, if

is zero
phase, then

is not; however, we could call

a
``

-phase filter'' if we like (a zero-phase filter in series with
a sign inversion).
Practical
zero-phase filters are
zero-phase in their
passbands, but
may switch between 0 and

in their stopbands (as illustrated in
the upcoming example of Fig.
10.2). Thus, typical zero-phase
filters are more precisely described as
piecewise constant-phase
filters, where the constant phase is 0 in all passbands, and

over various intervals within stopbands. Similarly, practical
``
linear phase'' filters are typically truly linear phase across their
passbands, but typically exhibit discontinuities by

radians in their
stopband(s). As long as the stopbands are negligible, which is the
goal by definition, the

-phase regions can be neglected
completely.
Figure
10.1 shows the
impulse response and
frequency response
of a length 11 zero-phase FIR lowpass
filter designed using the Remez
exchange algorithm.
11.2 The
matlab code for designing this filter is as
follows:
N = 11; % filter length - must be odd
b = [0 0.1 0.2 0.5]*2; % band edges
M = [1 1 0 0 ]; % desired band values
h = remez(N-1,b,M); % Remez multiple exchange design
The
impulse response
h is returned in
linear-phase form, so
it must be left-shifted

samples to make it zero phase.
Figure 10.1:
Impulse response and
frequency response of a length 11 zero-phase FIR lowpass filter. Note
that the frequency response is real because the filter is zero
phase. Also plotted (in dashed lines) are the desired passband and
stopband gains.
![\includegraphics[width=\twidth ]{eps/remezexa}](http://www.dsprelated.com/josimages_new/filters/img1185.png) |
Figure
10.2 shows the amplitude and
phase responses of the
FIR
filter designed by
remez. The phase response is zero
throughout the passband and
transition band. However, each
zero-crossing in the stopband results in a phase jump of

radians, so that the phase alternates between zero and

in the
stopband. This is typical of practical
zero-phase filters.
A practical
zero-phase filter was illustrated
in Figures
10.1 and
10.2. Some simple general cases are as
follows:
- The trivial (non-)filter
has frequency response
, which is zero phase for all
.
- Every second-order zero-phase FIR filter has an impulse
response of the form
where the coefficients
are assumed real. The transfer function
of the general, second-order, real, zero-phase filter is
and the frequency response is
which is real for all
.
- Extending the previous example, every order
zero-phase real FIR
filter has an impulse response of the form
and frequency response
which is clearly real whenever the coefficients
are real.
- There is no first-order (length 2) zero-phase filter, because,
to be even, its impulse response would have to be proportional to
. Since the bandlimited digital
impulse signal
is ideally interpolated using bandlimited
interpolation [91,84], giving samples of
sinc
--the
unit-amplitude sinc function having zero-crossings on the
integers, we see that sampling
on the integers yields
an IIR filter:
- Similarly, there are no odd-order (even-length) zero-phase filters.
Note that
odd impulse responses of the form

are
closely related to
zero-phase filters (even impulse responses). This
is because another
Fourier symmetry relation is that the
DTFT of an
odd sequence is purely
imaginary [
84].
In
practice,
Hilbert transform filters and
differentiators
are often implemented as odd
FIR filters [
68]. A
purely imaginary
frequency response can be divided by

to give a
real frequency response. As a result,
filter-design software for one
case is easily adapted to the other [
68].
Equivalently, an odd impulse response can be multiplied by

in the
time domain to yield a purely imaginary impulse response that
is
Hermitian. Hermitian
signals have real
Fourier
transforms [
84]. Therefore, a Hermitian impulse response gives
a
filter having a
phase response that is either zero or

at each
frequency.
As stated at the beginning of this chapter, the
impulse response of
every
causal,
linear-phase,
FIR filter is symmetric:
Assume that

is odd. Then the
filter
is a
zero-phase filter. Thus, every odd-length
linear-phase filter can be expressed as a delay of some
zero-phase filter,
By the
shift theorem for
z transforms (§
6.3), the
transfer
function of a linear-phase filter is
and the
frequency response is
which is a
linear phase term times

which is real.
Since

can go negative, the
phase response is
For frequencies

at which

is nonnegative, the
phase delay and
group
delay of a linear-phase filter are simply half its length:
- The example of §10.2.1 was in fact a linear-phase FIR
filter design example. The resulting causal finite impulse response
was left-shifted (``advanced'' in time) to make it zero phase.
- While the trivial ``bypass filter''
is zero-phase
(§10.2.2), the ``bypass filter with a unit delay,''
is linear phase. It is (trivially) symmetric
about time
, and the frequency response is
, which
is a pure linear phase term
having a slope
of
samples (radians per radians-per-sample), or
seconds
(radians per radians-per-second). The phase- and group-delays are
each 1 sample at every frequency.
- The impulse response of the simplest lowpass filter studied in
Chapter 1 was
[
].
Since this impulse response is symmetric about time
samples,
it is linear phase, and
, as derived
in Chapter 1. The phase delay and group delay are both
sample at
each frequency. Note that even-length linear-phase filters cannot be
time-shifted (without interpolation) to create a corresponding
zero-phase filter. However, they can be shifted to make a
near-zero-phase filter that has a phase delay and group delay equal to
half a sample at all passband frequencies.
The
Matlab Signal Processing Toolbox covers many applications
with the following functions:
All of these functions except
firls are implemented in the
free,
open-source,
Octave Forge collection as well.
Methods for
FIR filter design are discussed in the fourth book
of the music
signal processing series [
87], and classic
references include [
64,
68]. There is
also quite a large research literature on this subject.
In the same way that odd
impulse responses are related to even
impulse
responses,
linear-phase filters are closely related
to
antisymmetric impulse responses of the form

,

. An antisymmetric impulse response is
simply a delayed odd impulse response (usually delayed enough to make
it
causal). The corresponding
frequency response is not strictly
linear phase, but the phase is instead linear with a constant offset
(by

). Since an
affine function is any function of
the form

, where

and

are constants, an antisymmetric impulse response can be called an
affine-phase filter. These same remarks apply to any linear-phase
filter that can be expressed as a time-shift of a

-phase filter
(
i.e., it is inverting in some
passband). However, in practice, all
such filters may be loosely called ``linear-phase'' filters, because
they are designed and implemented in essentially the same
way [
68].
Note that truly linear-phase filters have both a constant
phase delay
and a constant
group delay. Affine-phase filters, on the other hand,
have a constant group delay, but not a constant phase
delay.
There are no
linear-phase recursive filters because a recursive filter
cannot generate a symmetric
impulse response. However,
it
is possible to implement a zero-phase filter
offline
using a recursive filter twice. That is, if the entire input
signal

is stored in a computer memory or hard disk, for example,
then we can apply a recursive filter both forward and backward in
time. Doing this
squares the
amplitude response of the filter
and
zeros the
phase response.
To show this analytically, let

denote the output of the first
filtering operation (which we'll take to be ``forward'' in time in the
normal way), and let

be the
impulse response of the recursive
filter. Then we have
where

is the input signal at sample

. For the second pass,
we ``flip''

to obtain

and apply the filter again:

F
LIP
The final output is then this result flipped:
where the last simplification tells us that flipping the input and
output signals is equivalent to flipping the impulse response
instead. Putting all these operations together, we
have
By the
flip theorem for z transforms, we have that the
z transform of
F
LIP
is

:
Using this result and applying the
convolution theorem
(§
6.3) twice gives the
z transform
On the unit circle, this reduces to, for
real filters 
,
If the filter were complex, then we would need to conjugate its
coefficients when running it backwards.
In summary, we have thus shown that forward-backward
filtering
squares the amplitude response and
zeros the
phase response. Note also that the phase response is truly zero,
never alternating between zero and

. No matter what
nonlinear
phase response

a filter may have, this phase is
completely canceled out by forward and backward filtering. The
amplitude response, on the other hand, is squared. For simple
bandpass filters (including lowpass, highpass, etc.), for which the
desired gain is 1 in the
passband and 0 in the stopband, squaring the
amplitude response usually
improves the response, because the
``stopband ripple'' (deviation from 0) is squared,
thereby
doubling the stopband attenuation in
dB. On the other
hand, passband ripple (deviation from 1) is only doubled by the
squaring (because

).
A
Matlab example of forward-backward filtering is presented in
§
11.6 (in Fig.
11.1).
For many applications (such as lowpass, bandpass, or highpass
filtering), the most
phase dispersion occurs at the extreme
edge of the
passband (
i.e., in the vicinity of
cut-off
frequencies). This phenomenon was clearly visible in the example
of Fig.
7.6.4. Only filters without feedback can have
exactly
linear phase (unless
forward-backward filtering is feasible),
and such filters generally need many more multiplies for a given
specification on the
amplitude response

[
68]. One should keep in mind that phase
dispersion near a cut-off frequency (or any steep transition in the
amplitude response) usually appears as
ringing near that
frequency in the time domain. (This can be heard in the upcoming
matlab example of §
11.6, Fig.
11.1.)
For musical purposes,

, or the effect that a filter has on
the
magnitude spectrum of the input
signal, is usually of primary
interest. This is true for all ``instantaneous'' filtering operations
such as tone controls, graphical
equalizers,
parametric equalizers,
formant
filter banks, shelving filters, and the like. (Elementary
examples in this category are discussed in Appendix
B.)
Notable exceptions are echo and
reverberation [
86], in which
delay characteristics are as important as magnitude characteristics.
When designing an ``instantaneous'' filtering operation,
i.e., when not
designing a ``
delay effect'' such as an echo unit or reverberator, the
amplitude response

should be
as smooth as possible
as a function of frequency 
. Smoother amplitude responses
correspond to shorter
impulse responses (when the phase is zero,
linear, or ``
minimum phase'' as discussed in the next chapter). By
keeping
impulse-responses as short as possible, phase dispersion is
minimized, and ideally inaudible. Linearizing the
phase response with
a delay equalizer (a type of
allpass filter) does not eliminate
ringing, but merely shifts it in time. A general rule of thumb is to
keep the total impulse-response duration below the time-discrimination
threshold of
hearing in the context of the intended application.
Next Section: Minimum-Phase FiltersPrevious Section: Implementation Structures for Recursive Digital Filters