20
D. Rocchesso: Sound Processing
averaging filter
magnitude response
phase response
finite-length impulse responses. Since the time extension of the impulse response
is N + 1 samples, we say that the FIR filter has length N + 1.
The transfer function is obtained as the Z transform of the impulse response
and it is a polynomial in the powers of z
-1
:
H(z) =
N
m=0
h(m)z
-m
= h(0) + h(1)z
-1
+ . . . + h(N )z
-N
.
(2)
Since such polynomial has order N , we also say that the FIR filter has order N .
2.1.1
The Simplest FIR Filter
Let us now consider the simplest nontrivial FIR filter that one can imagine, the
averaging filter
y(n) =
1
2
x(n) +
1
2
x(n - 1) .
(3)
In appendix B.1 it is illustrated how such filter can be implemented in Oc-
tave/Matlab in two different ways: block processing or sample-by-sample pro-
cessing. The simplest way to analyze the behavior of the filter [97] is probably
the injection of a complex sinusoid having amplitude A and initial phase , i.e.
the signal x(n) = Ae
j(
0
n+)
. Since the system is linear we do not loose any
generality by considering unit-amplitude signals (A = 1). Since the system is
time invariant we do not loose any generality by considering signals with initial
zero phase ( = 0). Since the complex sinusoid can be expressed as the sum of
a cosinusoidal real part and a sinusoidal imaginary part, we can imagine that
feeding the system with such a complex signal corresponds to feeding two copies
of the filter, the one with a cosinusoidal real signal, the other with a sinusoidal
real signal. The output of the filter fed with the complex sinusoid is obtained,
thanks to linearity, as the sum of the outputs of the two copies.
If we replace the complex sinusoidal input in eq. (3) we readily get
y(n) =
1
2
e
j
0
n
+
1
2
e
j
0
(n-1)
= (
1
2
+
1
2
e
-j
0
)e
j
0
n
= (
1
2
+
1
2
e
-j
0
)x(n) . (4)
We see that the output is a copy of the input multiplied by the complex number
(
1
2
+
1
2
e
-j
0
), wich is the value taken by the transfer function at the point
z = e
j
0
. In fact, the transfer function (2) can be rewritten, for the case under
analysis, as
H(z) =
1
2
+
1
2
z
-1
,
(5)
and its evaluation on the unit circle (z = e
j
) gives the frequency response
H() =
1
2
+
1
2
e
-j
.
(6)
For an input complex sinusoid having frequency
0
, the frequency response takes
value
H(
0
) =
1
2
+
1
2
e
-j
0
= (
1
2
e
j
0
/2
+
1
2
e
-j
0
/2
)e
-j
0
/2
= cos (
0
/2)e
-j
0
/2
, (7)
and we see that the magnitude response and the phase response are, respectively
|H(
0
)| = cos (
0
/2)
(8)