26
D. Rocchesso: Sound Processing
phase unwrapping
filter coefficients
more significant. In both cases, we have to be careful of a problem that often
arises when dealing with phases: the phase unwrapping. So far we have defined
the phase response as the angle of the frequency response, without bothering
about the fact that such an angle is defined univocally only between 0 and 2.
There is no way to distinguish an angle from those angles obtained by addition
of with multiples of 2. However, in order to give continuity to the phase and
group delays, we have to unwrap the phase into a continuous function. For
instance, the Matlab Signal Processing Toolbox provides the function unwrap
that unwraps the phase in such a way that discontinuities larger than a given
threshold are offset by 2. In Octave we can use the function unwrap found in
the web repository of this book.
Example 1. Fig. 7 shows the phase response of the FIR filter H(z) =
0.5 - 0.2z
-1
- 0.3z
-2
+ 0.8z
-3
before and after unwrapping. The following
0
1
2
3
-10
-8
-6
-4
-2
0
2
frequency [rad/sample]
phase [rad]
Phase response
Figure 7: Wrapped (dashed line) and unwrapped (solid line) phase response of
a third order FIR filter having impulse response: 0.5 -0.2 -0.3 0.8
Octave/Matlab script allows to plot the curve in fig. 7. It is illustrative of the
usage of the function unwrap with the default unwrapping threshold set to .
w = [0:0.01:pi];
H = 0.5 - 0.2*exp(-i*w ) - 0.3*exp(-2*i*w ) + 0.8*exp(-3*i*w ) ;
plot(w, unwrap(angle(H)), '-'); hold on;
plot(w, angle(H), '--'); hold off;
xlabel('frequency [rad/sample]');
ylabel('phase [rad]');
title('Phase response');
% replot; % Octave only
###
2.1.3
Higher-Order FIR Filters
An FIR filter is nothing more than the realization of the operation of convolu-
tion (1). The filter coefficients are the samples of the impulse response.
The FIR filters having an impulse response that is symmetric are particularly
important, since the phase of their frequency response is linear. More precisely,