PROPERTIES OF LINEAR-PHASE FIR FILTERS
7.2 PROPERTIES OF LINEAR-PHASE FIR FILTERS
In this section we discuss shapes of impulse and frequency responses and locations of system function zeros of linear-phase FIR filters. Let h(n),
0 ≤ n ≤ M − 1 be the impulse response of length (or duration) M. Then the system function is
M −1 !
M −1
H(z) = − h(n)z n
=z (M −1)
h(n)z M −1−n
n=0
n=0
which has (M − 1) poles at the origin z = 0 (trivial poles) and (M − 1) zeros located anywhere in the z-plane. The frequency response function is
M −1 ! H(e − jω )= h(n)e jωn , −π < ω ≤ π
n=0
Now we will discuss specific requirements on the forms of h(n) and H(e jω ) as well as requirements on the specific locations of (M − 1) zeros that the linear-phase constraint imposes.
7.2.1 IMPULSE RESPONSE h(n) We impose a linear-phase constraint
̸ H(e jω ) = −αω, −π < ω ≤ π
Chapter 7
FIR FILTER DESIGN
Symmetric Impulse Response: M odd
h(n)
0 (M – 1) / 2 (M – 1)
where α is a constant phase delay. Then we know from Chapter 6 that h(n) must be symmetric, that is,
M−1
h (n) = h(M − 1 − n),
0 ≤ n ≤ (M − 1) with α =
2 Hence h(n) is symmetric about α, which is the index of symmetry. There
are two possible types of symmetry: • M odd: In this case α = (M − 1)/2 is an integer. The impulse response
is as shown below. • M even: In this case α = (M − 1)/2 is not an integer. The impulse
response is as shown here.
Symmetric Impulse Response: M even
h(n)
0 M / 2+1M / 2 M–1
We also have a second type of “linear-phase” FIR filter if we require that the phase response ̸ H(e jω ) satisfy the condition
̸ H(e jω ) = β − αω
which is a straight line but not through the origin. In this case α is not a constant phase delay, but
d ̸ H(e jω ) = −α dω
Properties of Linear-phase FIR Filters 309
is constant, which is the group delay. Therefore α is called a constant group delay . In this case, as a group, frequencies are delayed at a constant rate. But some frequencies may get delayed more and others delayed less. For this type of linear phase one can show that
M−1
h (n) = −h(M −1−n),
0 ≤ n ≤ (M −1); α =
2 2 This means that the impulse response h(n) is antisymmetric. The index
of symmetry is still α = (M − 1)/2. Once again we have two possible types, one for M odd and one for M even.
• M odd: In this case α = (M − 1)/2 is an integer and the impulse
response is as shown.
Antisymmetric Impulse Response: M odd
h(n) 0
0 (M – 1) / 2 M–1
Note that the sample h(α) at α = (M − 1)/2 must necessarily be equal to zero, i.e., h((M − 1)/2) = 0.
• M even: In this case α = (M − 1)/2 is not an integer and the impulse
response is as shown.
Antisymmetric Impulse Response: M even
h(n) 0
0 M / 2 +1 M / 2 M–1
Chapter 7
FIR FILTER DESIGN
7.2.2 FREQUENCY RESPONSE H(e jω ) When the cases of symmetry and antisymmetry are combined with odd and even M , we obtain four types of linear-phase FIR filters. Frequency response functions for each of these types have some peculiar expressions and shapes. To study these responses, we write H(e jω ) as
H(e jω )=H r (ω)e j(β−αω) ; β =± ,α=
M−1
2 2 where H r (ω) is an amplitude response function and not a magnitude re-
sponse function. The amplitude response is a real function, but unlike the magnitude response, which is always positive, the amplitude response may be both positive and negative. The phase response associated with the magnitude response is a discontinuous function, while that associated with the amplitude response is a continuous linear function. To illustrate the difference between these two types of responses, consider the following example.
EXAMPLE 7.3 Let the impulse response be h(n) = {1 , 1, 1}. Determine and draw frequency responses. ↑
Solution
The frequency response function is
H(e jω )=
h(n)e jωn = 1 + 1e − jω +e − j2ω
= " e jω +1+e − jω # e − jω
= {1 + 2 cos ω} e − jω
From this the magnitude and the phase responses are |H(e jω )| = |1 + 2 cos ω| , 0<ω≤π
since cos ω can be both positive and negative. In this case the phase response is piecewise linear. On the other hand, the amplitude and the corresponding phase responses are
In this case the phase response is truly linear. These responses are shown in Figure 7.2. From this example, the difference between the magnitude and the amplitude (or between the piecewise linear and the linear-phase) responses should be clear.
Properties of Linear-phase FIR Filters 311
Magnitude Response
Amplitude Response
|H|
Hr
frequency in π units
frequency in π units
Piecewise Linear Phase Response
Linear Phase Response
π units
π units
angle in
angle in
frequency in π units
frequency in π units
FIGURE 7.2 Frequency responses in Example 7.3
Type-1 linear-phase FIR filter: Symmetrical impulse response, M odd In this case β = 0, α = (M − 1)/2 is an integer, and h(n) = h(M − 1 − n), 0 ≤ n ≤ M − 1. Then we can show (see Problem P7.2) that
a(n) cos ωn ⎦ − e jω(M −1)/2 (7.6)
n=0
where sequence a(n) is obtained from h(n) as
a(0) = h )M−1
: the middle sample
a(n) = 2h )M−1
Comparing (7.5) with (7.6), we have (M −1)/2 !
H r (ω) =
a(n) cos ωn
n=0
Chapter 7
FIR FILTER DESIGN
Type-2 linear-phase FIR filter: Symmetrical impulse response, M even In this case again β = 0 , h(n) = h(M −1−n), 0 ≤ n ≤ M−1, but α = (M −1)/2 is not an integer. Then we can show (see Problem P7.3) that
b(n) cos ω n−
⎦ e − jω(M −1)/2 (7.9)
b(n) = 2h
b(n) cos ω n−
n=1
Note: At ω = π we get
b(n) cos π n−
n=1
regardless of b(n) or h(n). Hence we cannot use this type (i.e., symmetric h(n), M even) for highpass or bandstop filters.
Type-3 linear-phase FIR filter: Antisymmetric impulse response, M odd In this case β = π/2, α = (M − 1)/2 is an integer, h(n) = −h(M − 1 − n), 0 ≤ n ≤ M − 1, and h((M − 1)/2) = 0. Then we can show (see Problem P7.4) that
⎡ (M −1)/2
jω
[ M 2 − ( 2 H(e −1 )= ⎣ c(n) sin ωn ⎦ e ) ω ] (7.12)
n=1
where
c(n) = 2h )M−1
c(n) sin ωn
n=1
Note: At ω = 0 and ω = π we have H r (ω) = 0, regardless of c(n) or h(n). Furthermore, e jπ/2 = j, which means that jH r (ω) is purely imagi- nary. Hence this type of filter is not suitable for designing a lowpass filter or a highpass filter. However, this behavior is suitable for approximat- ing ideal digital Hilbert transformers and differentiators. An ideal Hilbert
Properties of Linear-phase FIR Filters 313
transformer [23] is an all-pass filter that imparts a 90 ◦ phase shift on the input signal. It is frequently used in communication systems for modula- tion purposes. Differentiators are used in many analog and digital systems to take the derivative of a signal.
Type-4 linear-phase FIR filter: Antisymmetric impulse response, M even This case is similar to Type-2. We have (see Problem P7.5)
d(n) sin ω n−
⎦ e j[ 2 −ω (M −1)/2] (7.15)
d(n) = 2h
d(n) sin ω n−
n=1
Note: At ω = 0, H r (0) = 0 and e jπ/2 = j. Hence this type is also suitable for designing digital Hilbert transformers and differentiators.
7.2.3 MATLAB IMPLEMENTATION The MATLAB function freqz computes the frequency response from which we can determine the magnitude response but not the amplitude response. The SP toolbox now provides the function zerophase that can compute the amplitude response. However, it easy to write simple func- tions to compute amplitude responses for each of the four types. We pro- vide four functions to do this.
1. Hr type1: function [Hr,w,a,L] = Hr_Type1(h);
% Computes Amplitude response Hr(w) of a Type-1 LP FIR filter % ----------------------------------------------------------- % [Hr,w,a,L] = Hr_Type1(h) % Hr = Amplitude Response % w = 500 frequencies between [0 pi] over which Hr is computed %
a = Type-1 LP filter coefficients % L = Order of Hr %
h = Type-1 LP filter impulse response
% M = length(h); L = (M-1)/2; a = [h(L+1) 2*h(L:-1:1)]; % 1x(L+1) row vector n = [0:1:L];
% (L+1)x1 column vector
w = [0:1:500]’*pi/500; Hr = cos(w*n)*a’;
Chapter 7
FIR FILTER DESIGN
2. Hr type2: function [Hr,w,b,L] = Hr_Type2(h);
% Computes Amplitude response of a Type-2 LP FIR filter % ----------------------------------------------------- % [Hr,w,b,L] = Hr_Type2(h) % Hr = Amplitude Response % w = frequencies between [0 pi] over which Hr is computed %
b = Type-2 LP filter coefficients % L = Order of Hr %
h = Type-2 LP impulse response
% M = length(h); L = M/2; b = 2*[h(L:-1:1)]; n = [1:1:L]; n = n-0.5; w = [0:1:500]’*pi/500; Hr = cos(w*n)*b’;
3. Hr type3: function [Hr,w,c,L] = Hr_Type3(h);
% Computes Amplitude response Hr(w) of a Type-3 LP FIR filter % ----------------------------------------------------------- % [Hr,w,c,L] = Hr_Type3(h) % Hr = Amplitude Response % w = frequencies between [0 pi] over which Hr is computed %
c = Type-3 LP filter coefficients % L = Order of Hr %
h = Type-3 LP impulse response
% M = length(h); L = (M-1)/2; c = [2*h(L+1:-1:1)]; n = [0:1:L]; w = [0:1:500]’*pi/500; Hr = sin(w*n)*c’;
4. Hr type4: function [Hr,w,d,L] = Hr_Type4(h);
% Computes Amplitude response of a Type-4 LP FIR filter % ----------------------------------------------------- % [Hr,w,d,L] = Hr_Type4(h) % Hr = Amplitude Response % w = frequencies between [0 pi] over which Hr is computed %
d = Type-4 LP filter coefficients % L = Order of d %
h = Type-4 LP impulse response
% M = length(h); L = M/2; d = 2*[h(L:-1:1)]; n = [1:1:L]; n = n-0.5; w = [0:1:500]’*pi/500; Hr = sin(w*n)*d’;
Properties of Linear-phase FIR Filters 315
These four functions can be combined into one function, called ampl-res, that can be written to determine the type of the linear-phase filter and to implement the appropriate amplitude response expression. This is explored in Problem P7.6. The use of these functions is described in Examples 7.4 through 7.7.
The zerophase function from the SP toolbox is similar in use to the freqz function. The invocation [Hr,w, phi] = zerophase(b,a) returns the amplitude response in Hr, evaluated at 512 values around the top half of the unit circle in the array w and the continuous phase response in phi . Thus, this function can be used for both FIR and IIR filters. Other invocations are also available.
7.2.4 ZERO LOCATIONS Recall that for an FIR filter there are (M − 1) (trivial) poles at the origin and (M − 1) zeros located somewhere in the z-plane. For linear-phase FIR filters, these zeros possess certain symmetries that are due to the symmetry constraints on h(n). It can be shown (see [23] and Problem P7.7) that if H(z) has a zero at
z=z = re jθ 1
then for linear phase there must be a zero at
z=
= e jθ
For a real-valued filter we also know that if z 1 is complex, then there must
be a conjugate zero at z ∗ 1 = re − jθ , which implies that there must be a
zero at 1/z ∗
1 = (1/r) e . Thus a general zero constellation is a quadruplet
as shown in Figure 7.3. Clearly, if r = 1, then 1/r = 1, and hence the zeros are on the unit circle and occur in pairs
e jθ
and − e jθ
If θ = 0 or θ = π, then the zeros are on the real line and occur in pairs
and
Finally, if r = 1 and θ = 0 or θ = π, the zeros are either at z = 1 or z = −1. These symmetries can be used to implement cascade forms with linear-phase sections.
Chapter 7
FIR FILTER DESIGN
FIGURE 7.3
A general zero constellation
In the following examples, we illustrate the preceding properties of linear-phase FIR filters.
EXAMPLE 7.4 Let h(n) = {−4 , 1, −1, −2, 5, 6, 5, −2, −1, 1, −4}. Determine the amplitude re-
sponse H r (ω) and the locations of the zeros of H (z).
Solution Since M = 11, which is odd, and since h(n) is symmetric about α = (11−1)/2 = 5, this is a Type-1 linear-phase FIR filter. From (7.7) we have
a(0) = h (α) = h(5) = 6, a(1) = 2h(5 − 1) = 10, a(2) = 2h(5 − 2) = −4 a (3) = 2h (5 − 3) = −2, a (4) = 2h (5 − 4) = 2, a (5) = 2h (5 − 5) = −8 From (7.8), we obtain
H r (ω) = a(0) + a(1) cos ω + a(2) cos 2ω + a(3) cos 3ω + a(4) cos 4ω + a(5) cos 5ω = 6 + 10 cos ω − 4 cos 2ω − 2 cos 3ω + 2 cos 4ω − 8 cos 5ω
MATLAB script: >> h = [-4,1,-1,-2,5,6,5,-2,-1,1,-4];
>> M = length(h); n = 0:M-1; >> [Hr,w,a,L] = Hr_Type1(h);
Properties of Linear-phase FIR Filters 317
L=5 >> amax = max(a)+1; amin = min(a)-1; >> subplot(2,2,1); stem(n,h); axis([-1 2*L+1 amin amax]) >> xlabel(’n’); ylabel(’h(n)’); title(’Impulse Response’) >> subplot(2,2,3); stem(0:L,a); axis([-1 2*L+1 amin amax]) >> xlabel(’n’); ylabel(’a(n)’); title(’a(n) coefficients’) >> subplot(2,2,2); plot(w/pi,Hr);grid >> xlabel(’frequency in pi units’); ylabel(’Hr’) >> title(’Type-1 Amplitude Response’) >> subplot(2,2,4); pzplotz(h,1)
The plots and the zero locations are shown in Figure 7.4. From these plots, we observe that there are no restrictions on H r (ω) either at ω = 0 or at ω = π. There is one zero-quadruplet constellation and three zero pairs.
EXAMPLE 7.5 Let h(n) = {−4 , 1, −1, −2, 5, 6, 6, 5, −2, −1, 1, −4}. Determine the amplitude
response H r (ω) and the locations of the zeros of H (z).
Impulse Response
Type–1 Amplitude Response
h(n) 0 Hr
frequency in π units
a(n) coefficients
Pole–Zero Plot
z–plane
a(n) 0 0 − 5 imaginary axis − 1
real axis
FIGURE 7.4 Plots in Example 7.4
Chapter 7
FIR FILTER DESIGN
Solution This is a Type-2 linear-phase FIR filter since M = 12 and since h (n) is sym- metric with respect to α = (12 − 1) /2 = 5.5. From (7.10) we have
, b(1) = 2h -
2 − 1 = 12, b(2) = 2h
2 − 2 = 10, b(3) = 2h 2 − 3 = −4
, b(4) = 2h - 2 − 4 = −2, b(5) = 2h 2 − 5 = 2, b(6) = 2h 12 2 − 6 = −8
Hence from (7.11) we obtain
r (ω) = b(1) cos ω 1− 1 -/
1 -/
1 -/ 2 + b(2) cos ω 2− 2 + b(3) cos ω 3− 2
. , + b(4) cos -/ ω 4− 2 + b(5) cos ω 5− 1 2 + b(6) cos ω 6− 1 2
2 2 MATLAB script:
>> h = [-4,1,-1,-2,5,6,6,5,-2,-1,1,-4]; >> M = length(h); n = 0:M-1; [Hr,w,a,L] = Hr_Type2(h); >> b,L
L=6 >> bmax = max(b)+1; bmin = min(b)-1; >> subplot(2,2,1); stem(n,h); axis([-1 2*L+1 bmin bmax]) >> xlabel(’n’); ylabel(’h(n)’); title(’Impulse Response’) >> subplot(2,2,3); stem(1:L,b); axis([-1 2*L+1 bmin bmax]) >> xlabel(’n’); ylabel(’b(n)’); title(’b(n) coefficients’) >> subplot(2,2,2); plot(w/pi,Hr);grid >> xlabel(’frequency in pi units’); ylabel(’Hr’) >> title(’Type-1 Amplitude Response’) >> subplot(2,2,4); pzplotz(h,1)
The plots and the zero locations are shown in Figure 7.5. From these plots, we observe that H r (ω) is zero at ω = π. There is one zero-quadruplet constellation, three zero pairs, and one zero at ω = π as expected.
EXAMPLE 7.6 Let h(n) = {−4 , 1, −1, −2, 5, 0, −5, 2, 1, −1, 4}. Determine the amplitude re-
sponse H r (ω) and the locations of the zeros of H (z).
Solution Since M = 11, which is odd, and since h(n) is antisymmetric about α = (11 − 1)/2 = 5, this is a Type-3 linear-phase FIR filter. From (7.13) we have
c(0) = h (α) = h(5) = 0, c(1) = 2h(5 − 1) = 10, c(2) = 2h(2 − 2) = −4 c (3) = 2h (5 − 3) = −2, c (4) = 2h (5 − 4) = 2, c (5) = 2h (5 − 5) = −8
Properties of Linear-phase FIR Filters 319
Impulse Response
Type–2 Amplitude Response
frequency in π units
b(n) coefficients
Pole–Zero Plot z–plane
b(n)
imaginary axis
real axis
FIGURE 7.5 Plots in Example 7.5 From (7.14) we obtain
H r (ω) = c(0) + c(1) sin ω + c(2) sin 2ω + c(3) sin 3ω + c(4) sin 4ω + c(5) sin 5ω = 0 + 10 sin ω − 4 sin 2ω − 2 sin 3ω + 2 sin 4ω − 8 sin 5ω
MATLAB script: >> h = [-4,1,-1,-2,5,0,-5,2,1,-1,4];
>> M = length(h); n = 0:M-1; [Hr,w,c,L] = Hr_Type3(h); >> c,L a=0
L=5 >> cmax = max(c)+1; cmin = min(c)-1; >> subplot(2,2,1); stem(n,h); axis([-1 2*L+1 cmin cmax]) >> xlabel(’n’); ylabel(’h(n)’); title(’Impulse Response’) >> subplot(2,2,3); stem(0:L,c); axis([-1 2*L+1 cmin cmax]) >> xlabel(’n’); ylabel(’c(n)’); title(’c(n) coefficients’) >> subplot(2,2,2); plot(w/pi,Hr);grid >> xlabel(’frequency in pi units’); ylabel(’Hr’) >> title(’Type-1 Amplitude Response’) >> subplot(2,2,4); pzplotz(h,1)
Chapter 7
FIR FILTER DESIGN
The plots and the zero locations are shown in Figure 7.6. From these plots, we observe that H r (ω) = 0 at ω = 0 and at ω = π. There is one zero-quadruplet constellation, two zero pairs, and zeros at ω = 0 and ω = π as expected.
Impulse Response
Type–3 Amplitude Response
5 20 h(n) 0 Hr 10 − 5 0 − 10
frequency in π units
c(n) coefficients
Pole–Zero Plot
z–plane
c(n) 0 0 − 5 imaginary axis − 1
real axis
FIGURE 7.6 Plots in Example 7.6
EXAMPLE 7.7 Let h(n) = {−4 , 1, −1, −2, 5, 6, −6, −5, 2, 1, −1, 4}. Determine the amplitude
response H r (ω) and the locations of the zeros of H (z).
Solution This is a Type-4 linear-phase FIR filter since M = 12 and since h (n) is anti- symmetric with respect to α = (12 − 1) /2 = 5.5. From (7.16) we have
, d(1) = 2h - 12 2 − 1 = 12, d(2) = 2h 12 2 − 2 = 10, d(3) = 2h 12 2 − 3 = −4
d(4) = 2h - 12 − , 4 = −2, d(5) = 2h 12 -
, - 2 2 − 5 = 2, d(6) = 2h 12 2 − 6 = −8
Hence from (7.17) we obtain
2 0 13 2 0 13 2 0 13 H r (ω) = d(1) sin ω 1− 1 + d(2) sin ω 2− 1 + d(3) sin ω 3− 1 2 2 2
+d(4) sin ω
+ d(5) sin ω 5−
+ d(6) sin ω 6− 2 2 2
= 12 sin
+ 10 sin
4 sin
2 sin
+2 sin
− 8 sin
Properties of Linear-phase FIR Filters 321
Impulse Response
Type–4 Amplitude Response
frequency in π units
d(n) coefficients
Pole–Zero Plot z–plane
d(n)
imagninary axis −
real axis
FIGURE 7.7 Plots in Example 7.7
MATLAB script: >> h = [-4,1,-1,-2,5,6,-6,-5,2,1,-1,4];
>> M = length(h); n = 0:M-1; [Hr,w,d,L] = Hr_Type4(h); >> b,L
L=6 >> dmax = max(d)+1; dmin = min(d)-1; >> subplot(2,2,1); stem(n,h); axis([-1 2*L+1 dmin dmax]) >> xlabel(’n’); ylabel(’h(n)’); title(’Impulse Response’) >> subplot(2,2,3); stem(1:L,d); axis([-1 2*L+1 dmin dmax]) >> xlabel(’n’); ylabel(’d(n)’); title(’d(n) coefficients’) >> subplot(2,2,2); plot(w/pi,Hr);grid >> xlabel(’frequency in pi units’); ylabel(’Hr’) >> title(’Type-1 Amplitude Response’) >> subplot(2,2,4); pzplotz(h,1)
The plots and the zero locations are shown in Figure 7.7. From these plots, we observe that H r (ω) is zero at ω = 0. There is one zero-quadruplet constellation, three zero pairs, and one zero at ω = 0 as expected.
Chapter 7
FIR FILTER DESIGN