28
D. Rocchesso: Sound Processing
. The filter that we are going to analyze has transfer function
H(z) = a
0
+ a
1
z
-1
+ a
0
z
-2
.
(19)
The impulse response is symmetric and, therefore, its phase response is linear.
The frequency response can be calculated as
H() = a
0
+ a
1
e
-j
+ a
0
e
-2j
= e
-j
a
0
e
j
+ a
1
+ a
0
e
-j
= e
-j
(a
1
+ 2a
0
cos ) .
(20)
As we have anticipated, the phase is linear and we have a phase delay of one sam-
ple. The magnitude of the frequency response is a function of the two parameters
a
0
and a
1
. Therefore, the designer has two degrees of freedom to control, for
instance, the magnitude of the frequency response at two distinct frequencies.
A first property that one might want to impose is a lowpass shape to the
frequency response. The reader, starting from (20), can easily verify that a
sufficient condition to ensure that the magnitude of the frequency response is a
decreasing monotonic function is that
a
1
2a
0
0 .
(21)
If we want to set the magnitude A
1
at the frequency
1
and the magnitude A
2
at the frequency
2
we have to solve the linear system of equations
a
1
+ 2a
0
cos
1
= A1
a
1
+ 2a
0
cos
2
= A2 ,
that can be expressed in matrix form as
1 2 cos
1
1 2 cos
2
a
1
a
0
=
A
1
A
2
.
(22)
For instance, if
1
= 0.01,
2
= 2.0, A
1
= 1.0 and A
2
= 0.5, in Octave/Matlab
a system such as this can be written and solved with the script
w1 = 0.01; w2 = 2.0;
A1 = 1.0; A2 = 0.5;
A = [ 1 2*cos(w1) ; 1 2*cos(w2)];
b = [A1 ; A2];
a = A \ b;
% solution of the system b = A a
and the solutions returned for the variables a
1
and a
0
are, respectively,
a=
0.64693
0.17654
The frequency response of this filter is shown in fig. 8. If we design the
second-order filter by specification of the frequency response at two arbitrary
4
The reader can analyze the filter H(z) = 0.5 - 0.5z
-1
and verify that it is a highpass
filter.