Lecture 5
Filter Structure Part 1
(Chapter 7 Mitras Textbook)
Main Contents
Lesson 1: Linear-Phase Filter
Lesson 2: Properties of Linear-Phase Filter
Lesson 3: Matlab Implementation
Lesson 4: Minimum Phase Filter
Classification Based on Phase Characteristics
n
In many applications, it is necessary that the digital filter
designed does not distort the phase of the input signal
components with frequencies in the passband
One way to avoid any phase distortion is to make the
frequency response of the filter real and nonnegative,
i.e., to design the filter with a zero phase characteristic
However, it is not possible to design a causal digital filter
with a zero phase
y(n)
jw
x(n)
H (e )
Y (e ) = X (e ) H (e ) = X ( e ) H (e ) e
jw
jw
jw
jw
jw
jH (
jw
Zero-Phase Transfer Function
n
For non-real-time processing of real-valued input signals
of finite length, zero-phase filtering can be very simply
implemented by relaxing the causality requirement
One zero-phase filtering scheme is sketched below
It is easy to verify the above scheme in the frequency
domain. Let X(ejw), U(ejw), V(ejw), Y(ejw) denotes the
DTFT of x[n], u[n], v[n] and y[n], respectively.
Zero-Phase Transfer Function
n
From the figure shown earlier and making use of the
symmetry relations we arrive at the relations between
various DTFTs as follows:
Linear-Phase Transfer Function
n
In case of a causal transfer function with non-zero phase
response, the phase distortion can be avoided by ensuring
that transfer function has a unity magnitude and a linear
phase characteristic in the frequency band of interest
The most general type of a filter with a linear phase has a
frequency response given by
jw
H (e ) = e
jDw
which has a linear phase from w=0 to w=2. Note that:
H (e jw ) = 1
( w) = D
Linear-Phase Transfer Function
n
The output y[n] of this filter to an input x[n]=Aejwn is then
given by:
y[n] = Ae jwn e jDw = Ae jw( n D )
If xa(t) and ya(t) represent the continuous-time signals whose
sampled versions, sampled at t = nT, are x[n] and y[n] given
above, then the delay between xa(t) and ya(t) is precisely the
group delay of amount D (waveform of the underlying
continuous-time output is identical to waveform of underlying
continuous-time input and delayed D units of time)
If D is an integer, then y[n] is identical to x[n], but delayed by
D samples. If D is not an integer, y[n], being delayed by a
fractional part, is not identical to x[n]
Linear-Phase Transfer Function
n
If it is desired to pass input signal components in a certain
frequency range undistorted in both magnitude and
phase, then the transfer function should exhibit a unity
magnitude response & linear-phase response in the band
of interest
Figures show the frequency
response of a lowpass filter with
a linear-phase characteristic in
the passband
Since the signal components in
the stopband are blocked, the
phase response in the stopband
can be of any shape
Why Linear-Phase Filter ?
n
Since a linear phase (or generalized linear phase) filter
has constant group delay, all frequency components
have equal delay times.
Linear phase system has the property of the
true time delay (invariance of time delay with freq.). That
is, there is no distortion due of select frequencies; In
many applications, this constant group delay is
advantageous.
By contrast, a filter with non-linear phase has a group
delay that varies with frequency, resulting in
phase distortion.
Examples of Linear/Nonlinear-Phase Filter
Group Delay & more
n
Group delay is a measure of the transit time of a signal
through a device under test (DUT), versus frequency (all
signals are delayed when transiting through a "device"
such as air, an amplifier or a loudspeaker).
This small delay is usually not a problem, but if the delay
is different for different frequencies and the signal is built
up by more than one frequency, then the shape of the
signal is distorted. This difference in delay for different
frequencies is what group delay is all about.
Group delay has some importance in the audio field and
especially in sound reproduction field. Many components
ofan audio reproduction chain, notably loudspeakers and
multiway loudspeakers crossover networks, introduce
group delay in the audio signal.
Phase Distortion & more
Audibility and Musical Understanding of Phase Distortion
http://www.ocf.berkeley.edu/~ashon/audio/phase/
phaseaud2.htm
Phase Distortion in Loudspeakers: crossover network
How to measure the phase performance of a
loudspeaker ?
n Phase Distortion at Passband Edges
http://www.dsprelated.com/dspbooks/filters/
Phase_Distortion_Passband_Edges.html
the most phase dispersion occurs at the extreme
edge of the passband
delay effects on echo and reverberation
n
How To Obtain Linear-Phase ?
n
Determine the impulse response of an ideal lowpass
filter with a linear phase response:
jwn0
1
.
e
0 < w < wc
jw
H (e ) =
wc < w <
0
Applying the time-shifting property of the DTFT to the
impulse response of an ideal zero-phase lowpass filter
we arrive at
sin wc (n no )
hLP [n] =
wc (n no )
n
As before, the above filter is noncausal and of doubly
infinite length, and hence, unrealizable
Truncation
n
By truncating the impulse response to a finite number of
terms, a realizable FIR approximation to the ideal lowpass
filter can be developed. The truncated approximation may
or may not exhibit linear phase, depending on the value of
n0 chosen
If we choose n0=N/2 with N a positive integer, the truncated
and shifted approximation is given by
sin wc (n N / 2)
hLP [n] =
0n N
wc (n N / 2)
which is IR of causal linear-phase FIR filter with a length of
N+1
Linear-Phase Frequency Response
n
Figure below shows the filter coefficients obtained using the
truncated function sinc for two different values of N
Linear-Phase Frequency Response
Because of symmetry of the impulse response coefficients
as indicated in the 2 figures, the frequency response of the
truncated approximation can be expressed:
N
jw
jwn
jwN / 2 ~
H LP (e ) = hLP [n]e
=e
H LP ( w)
n =0
where H~LP(w) is zero-phase response
Main Contents
Lesson 1: Linear-Phase Filter
Lesson 2: Properties of Linear-Phase Filter
Lesson 3: Matlab Implementation
Lesson 4: Minimum Phase Filter
Properties of Linear-Phase FIR Filter
First type of linear phase:
H (e jw ) = w,
< w , : constant phase delay
n For symmetric impulse response: Filter length M can
be odd (type I) or even (type II).
n
=
h(n): M points
h(n-(M-1)/2): M points
--> Shift
right
(M-1)/2
-(M-1)/2
(M-1)/2
h(n): M points
H (e jw ), real,
M-1
h(n-(M-1)/2): M points
--> Shift
right
(M-1)/2
-(M-1)/2
M 1
2
(M-1)/2
M-1
H (e jw )e
M 1
j
w
2
Properties of Linear-Phase FIR Filter
n
Second type of linear phase:
# M "1
!H (e ) = ! " " w = "
w, " # < w # #
2
2
For anti-symmetric impulse response: filter length M
can be odd (type III) or even (type IV).
jw
H (e jw ), real, H (e jw )e
M 1
j
w
2
h( n) = h( M 1 n)
n
Constant group delay: no matter which frequency, the
sinusoids all get the same amount of delay (depending
on the value, sin can be changed to cos)
dH (e jw )
=
dw
Frequency Response
n
n
n
There are, thus, four types of linear phase FIR filters
Frequency response functions for each of these types
have some special expressions and shapes
Re-write H(ejw) as
jw
jw
H (e ) = H r (e )e
j ( w )
M 1
; = , =
2
2
Hr(ejw) is an amplitude response function (real function,
pos. & neg.) and not a magnitude response function.
The phase response associated with the magnitude
response is a discontinuous function, while that
associated with the amplitude response is a continuous
linear function
Example 7.3
Let the imp. res. be h(n) = {1,1,1}. Determine and draw
frequency responses
The frequency response function:
The magnitude and phase response:
The amplitude and phase response:
Type-1: Symmetrical IR, M odd
n
With type-1 case, beta=0, alpha=(M-1)/2 is an integer,
and h(n)=h(M-1-n), 0<=n<=M-1. Then
( M 1) / 2
jw( M 1) / 2
jw
H (e ) = a(n) cos wn e
n =0
M 1
a (0) = h
: the middle sample
2
M 3
M 1
a (n) = 2h
n , 1 n
2
2
H r ( w) =
n
Problem 7.1
( M 1) / 2
a(n) cos wn
n =0
Type-2: Symmetrical IR, M even
n
With type-2 case, beta=0, alpha=(M-1)/2 is not an
integer, and h(n)=h(M-1-n), 0<=n<=M-1. Then
M /2
1 jw( M 1) / 2
jw
H (e ) = b(n) cosw n e
2
n=1
M
M
b(n) = 2h n , n = 1,2,,
2
2
M /2
1
H r ( w) = b(n) cosw n
2
n =1
n
Problem 7.2
As Hr(pi)=0, hence we cannot use this type for highpass
or bandstop filters (why ?)
Type-3: Anti-sym IR, M odd
n
With type-3 case, beta=pi/2, alpha=(M-1)/2 is an integer,
and h(n)=-h(M-1-n), 0<=n<=M-1. Then
( M 1) / 2
j [2 ( M21 )w]
jw
H (e ) = c(n) sin wn e
n =0
M 1
M 1
c(n) = 2h
n , n = 1,2,,
2
2
H r ( w) =
( M 1) / 2
c(n) sin wn
n =0
Problem 7.3
Hr(0)=Hr(pi)=0, exp(j*pi/2)=j, hence this type of filter is
not suitable for designing a lowpass filter or a highpass
filter. But it is suitable for approximating ideal digital
Hilbert Transformer and differentiator.
Type-4: Anti-sym IR, M even
n
With type-4 case, beta=pi/2, alpha=(M-1)/2 is not an
integer, and h(n)=-h(M-1-n), 0<=n<=M-1. Then
M /2
1 j [2 w( M 1) / 2 ]
jw
H (e ) = d (n) sin w n e
2
n=1
M
M
d (n) = 2h n , n = 1,2, ,
2
2
M /2
1
H r ( w) = d (n) sin w n
2
n =1
Problem 7.4
Hr(pi)=0, exp(j*pi/2)=j, hence this type of filter is also
suitable for designing digital Hilbert transformer &
differentiators.
Main Contents
Lesson 1: Linear-Phase Filter
Lesson 2: Properties of Linear-Phase Filter
Lesson 3: Matlab Implementation
Lesson 4: Minimum Phase Filter
Matlab Implementation
n
Hr-type 1
Hr-type 2
Hr-type 3
Hr-type 4
Quadruplet Zero Constellation
n
If H(z) has a zero at:
Then for linear phase there must be a zero at:
For a real-valued filter, if z1 is complex, then there must
be a conjugate zero at z1* and a zero at 1/ z1*
Quadruplet Zero Constellation
1.5
1/Conj
(Z1)
Imaginary Part
0.5
Z1
0
-0.5
Conj(Z1)
-1
1/z1
-1.5
-2
Ex 7.4 7.7
-1.5
-1
-0.5
0
Real Part
0.5
1.5
Example 7.4
Example 7.5
Example 7.6
Example 7.7
Main Contents
Lesson 1: Linear-Phase Filter
Lesson 2: Properties of Linear-Phase Filter
Lesson 3: Matlab Implementation
Lesson 4: Minimum Phase Filter
Minimum Phase Filters
n
A digital filter H(z) is minimum phase if all of its zeros
lie inside or on the unit circle.
2( z + 0.5)( z 0.5)
,
2
( z 0.5) + 0.25
( z + 2)( z 0.5)
H10 ( z ) =
,
2
( z 0.5) + 0.25
( z + 0.5)( z 2)
H 01 ( z ) =
,
2
( z 0.5) + 0.25
0.5( z + 2)( z 2)
H11 ( z ) =
.
2
( z 0.5) + 0.25
H 00 ( z ) =
Minimum Phase Filters
n
n
Among filters with the same magnitude response, the
minimum phase filter has the smallest amount of phase lag.
Every IIR filter can be converted into minimum phase filter
by replacing the zeros outside the unit circle with their
reciprocals.
0
2
0
Multiply with Allpass Filter
n
n
n
Allpass filter has H (e ) = 1 for all w
Phase response is not zero, is always decreasing -> used for
phase correction and other special effects
Hall(z) has poles p where AM(p)=0 and zeros o=1/p
1
aM + aM 1 z 1 + ... + z M
A
(
z
)
M
M
H all ( z ) =
= z
1
M
1 + a1 z + ... + aM z
AM ( z )
A special case is to convert any H(z) to minimum phase by
multiplying an allpass filter:
1
H ( z ) = H all ( z ) H min ( z ) H min ( z ) = H all
( z)H ( z)
Multiply with Allpass Filter
n
Allpass filters can be used to compensate the phase
responses. A special case is to convert any H(z) to minimum
phase by multiplying an allpass filter.
Minimum-Phase Decomposition
n
n
Set Hmin(z)=H(z), and Hall(z)=1.
Factor the numerator polynomial
b( z ) = b0 ( z z1 )(z z2 )( z zm )
n
For i=1 to m do
{
If |zi|>1 then compute
z z +1
F ( z) = i
z zi
H min ( z ) = F ( z ) H min ( z )
}
H all ( z ) = F 1 ( z ) H all ( z )