In digital signal processing applications,
it is often necessary to change the relative amplitudes
of frequency components or remove undesired frequencies of
a signal.
This process is called filtering.
Digital filters are used in a variety of applications.
In Laboratory 4, we saw that digital filters
may be used in systems that perform interpolation and decimation
on discrete-time signals.
Digital filters are also used in audio systems
that allow the listener to adjust the bass (low-frequency energy)
and the treble (high frequency energy) of audio signals.
Digital filter design requires the use of both frequency domain
and time domain techniques.
This is because filter design specifications are often given
in the frequency domain, but filters are usually implemented
in the time domain with a difference equation.
Typically, frequency domain analysis is done using the Z-transform and
the discrete-time Fourier Transform (DTFT).
In general, a linear and time-invariant causal digital filter
with input x(n)x(n) and
output y(n)y(n) may be specified by its difference equation
y
(
n
)
=
∑
i
=
0
N
-
1
b
i
x
(
n
-
i
)
-
∑
k
=
1
M
a
k
y
(
n
-
k
)
y
(
n
)
=
∑
i
=
0
N
-
1
b
i
x
(
n
-
i
)
-
∑
k
=
1
M
a
k
y
(
n
-
k
)
(1)where bibi and akak are coefficients which parameterize
the filter. This filter is said to have NN zeros and MM poles.
Each new value of the output signal, y(n)y(n), is determined
by past values of the output, and by present and past values
of the input.
The impulse response, h(n)h(n), is the response of the filter
to an input of δ(n)δ(n), and is therefore the
solution to the recursive difference equation
h
(
n
)
=
∑
i
=
0
N
-
1
b
i
δ
(
n
-
i
)
-
∑
k
=
1
M
a
k
h
(
n
-
k
)
.
h
(
n
)
=
∑
i
=
0
N
-
1
b
i
δ
(
n
-
i
)
-
∑
k
=
1
M
a
k
h
(
n
-
k
)
.
(2)There are two general classes of digital filters:
infinite impulse response (IIR) and finite impulse response (FIR).
The FIR case occurs when ak=0ak=0, for all kk. Such a filter is said
to have no poles, only zeros.
In this case, the difference equation in Equation 2
becomes
h
(
n
)
=
∑
i
=
0
N
-
1
b
i
δ
(
n
-
i
)
.
h
(
n
)
=
∑
i
=
0
N
-
1
b
i
δ
(
n
-
i
)
.
(3)Since Equation 3 is no longer recursive,
the impulse response has finite duration NN.
In the case where ak≠0ak≠0, the difference equation
usually represents an IIR filter.
In this case, Equation 2
will usually generate an impulse response which has non-zero
values as n→∞n→∞.
However, later we will see that for certain values
of ak≠0ak≠0 and bibi, it is possible
to generate an FIR filter response.
The Z-transform is the major tool used for analyzing
the frequency response of filters and their difference
equations.
The Z-transform of a discrete-time signal, x(n)x(n), is given by
X
(
z
)
=
∑
n
=
-
∞
∞
x
(
n
)
z
-
n
.
X
(
z
)
=
∑
n
=
-
∞
∞
x
(
n
)
z
-
n
.
(4)where zz is a complex variable.
The DTFT may be thought of as a special case of the Z-transform
where zz is evaluated on the unit circle in the complex plane.
X
(
e
j
ω
)
=
X
(
z
)
z
=
e
j
ω
=
∑
n
=
-
∞
∞
x
(
n
)
e
-
j
ω
n
X
(
e
j
ω
)
=
X
(
z
)
z
=
e
j
ω
=
∑
n
=
-
∞
∞
x
(
n
)
e
-
j
ω
n
(5)From the definition of the Z-transform, a change of variable
m=n-Km=n-K shows
that a delay of KK samples in the time domain is equivalent to
multiplication by z-Kz-K in the Z-transform domain.
x
(
n
-
K
)
↔
Z
∑
n
=
-
∞
∞
x
(
n
-
K
)
z
-
n
=
∑
m
=
-
∞
∞
x
(
m
)
z
-
(
m
+
K
)
=
z
-
K
∑
m
=
-
∞
∞
x
(
m
)
z
-
m
=
z
-
K
X
(
z
)
x
(
n
-
K
)
↔
Z
∑
n
=
-
∞
∞
x
(
n
-
K
)
z
-
n
=
∑
m
=
-
∞
∞
x
(
m
)
z
-
(
m
+
K
)
=
z
-
K
∑
m
=
-
∞
∞
x
(
m
)
z
-
m
=
z
-
K
X
(
z
)
(6)We may use this fact to re-write Equation 1 in
the Z-transform domain, by taking Z-transforms of both sides of
the equation:
Y
(
z
)
=
∑
i
=
0
N
-
1
b
i
z
-
i
X
(
z
)
-
∑
k
=
1
M
a
k
z
-
k
Y
(
z
)
Y
(
z
)
1
+
∑
k
=
1
M
a
k
z
-
k
=
X
(
z
)
∑
i
=
0
N
-
1
b
i
z
-
i
H
(
z
)
=
△
Y
(
z
)
X
(
z
)
=
∑
i
=
0
N
-
1
b
i
z
-
i
1
+
∑
k
=
1
M
a
k
z
-
k
Y
(
z
)
=
∑
i
=
0
N
-
1
b
i
z
-
i
X
(
z
)
-
∑
k
=
1
M
a
k
z
-
k
Y
(
z
)
Y
(
z
)
1
+
∑
k
=
1
M
a
k
z
-
k
=
X
(
z
)
∑
i
=
0
N
-
1
b
i
z
-
i
H
(
z
)
=
△
Y
(
z
)
X
(
z
)
=
∑
i
=
0
N
-
1
b
i
z
-
i
1
+
∑
k
=
1
M
a
k
z
-
k
(7)From this formula, we see that any filter which can be represented
by a linear difference equation with constant coefficients
has a rational transfer function
(i.e. a transfer function which is a ratio of polynomials).
From this result, we may compute the frequency response
of the filter by evaluating H(z)H(z) on the unit circle:
H
(
e
j
ω
)
=
∑
i
=
0
N
-
1
b
i
e
-
j
ω
i
1
+
∑
k
=
1
M
a
k
e
-
j
ω
k
.
H
(
e
j
ω
)
=
∑
i
=
0
N
-
1
b
i
e
-
j
ω
i
1
+
∑
k
=
1
M
a
k
e
-
j
ω
k
.
(8)There are many different methods for implementing a general
recursive difference equation of the form Equation 1.
Depending on the application, some methods may be more robust
to quantization error, require fewer multiplies or adds,
or require less memory.
Figure 1 shows a system diagram known
as the direct form implementation; it works for any discrete-time filter
described by the difference equation in Equation 1.
Note that the boxes containing the symbol z-1z-1 represent unit delays, while a parameter written next to a signal path
represents multiplication by that parameter.