College 07
College 07
College 07
=
=
=
=
( ) ( ). ( ) Y z H z X z =
( )
( )
( )
Y z
H z
X z
=
FIR and IIR Transfer Functions
recall the LTI FIR input output relation:
2
1
[ ] [ ] [ ]
N
k N
y n h k x n k
=
=
=
=
for a causal FIR filter, 0 N
1
N
2
. Note that all poles are at the origin
of the z plane and that the ROC is the entire z plane except the origin.
FIR and IIR Transfer Functions
recall the LTI IIR difference equation:
0 0
[ ] [ ]
N M
k k
k k
a y n k b x n k
= =
=
applying the z transform to both sides of the difference equation
and making use of the linearity and time shifting properties of the
z transform gives:
leading to the generalised form:
0
0
( )
( )
( )
M
k
k
k
N
k
k
k
b z
Y z
H z
X z
a z
=
= =
0 0
( ) ( )
N M
k k
k k
k k
a z Y z b z X z
= =
=
Digital Signal Processing, Digital Signal Processing, 2007 Robi Polikar, Rowan University 2007 Robi Polikar, Rowan University
An Example
An Example
Consider the M-point moving-average FIR filter with an impulse response
= ] [n h
otherwise , 0
1 0 , / 1 M n M
( )
( )
1
1
0
1 1 1
( )
[ 1 ]
1
M M
M
n
M
n
z z
H z z
M M z z
M z
=
= = =
j
e H
= ) (
1 ) ( = H = = ) ( ) ( H
o
o
o p
=
) (
) (
0
0
( )
( )
g
d
d
=
=
Digital Signal Processing, Digital Signal Processing, 2007 Robi Polikar, Rowan University 2007 Robi Polikar, Rowan University
What is the Big Deal
What is the Big Deal
?
?
The deal is huge!
If the phase spectrum is linear, then the phase delay is independent of
the frequency, and it is the same constant for all frequencies.
In other words, all frequencies are delayed by seconds, or
equivalently, the entire signal is delayed by seconds.
Since the entire signal is delayed by a constant amount, there is no distortion!
If the filter does not have linear phase, then different frequency
components are delayed by different amounts, causing significant
distortion.
Digital Signal Processing, Digital Signal Processing, 2007 Robi Polikar, Rowan University 2007 Robi Polikar, Rowan University
Take Home Message
Take Home Message
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 and a linear-phase
response in the band of interest
|H
LP
()|
H
LP
()
Digital Signal Processing, Digital Signal Processing, 2007 Robi Polikar, Rowan University 2007 Robi Polikar, Rowan University
Generalized Linear Phase
Generalized Linear Phase
Now consider the following system, where G() is real (i.e., no phase)
From our previous discussion, the term e
-j
simply introduces a phase
delay, that is, normally independent of frequency. Now,
If G() is positive, the phase term is ()=-, hence the system has linear phase.
If G()<0, then a 180 ( rad) phase term is added to the phase spectrum.
Therefore, the phase response is ()=-+, the phase delay is no longer
independent of frequency
We can, however, write H()=-[e
-j
G()], and the function inside brackets has
now linear phase no distortion. The negative signs simply flips the signal.
As long as the system response does not change signs for different values of , it
can be written as a linear phase transfer function. Therefore, such systems are said
to have generalized linear phase
In general, a system whose group delay is constant , for all passband frequencies is
considered as a generalized linear phase filter.
) ( ) (
G e H
j
=
Digital Signal Processing, Digital Signal Processing, 2007 Robi Polikar, Rowan University 2007 Robi Polikar, Rowan University
Approximately Linear Phase
Approximately Linear Phase
Consider the following transfer functions
Note that above a certain frequency, say
c
, the magnitude is very close to zero, that
is most of the signal above this frequency is suppressed. So, if the phase response
deviates from linearity above these frequencies, then signal is not distorted much,
since those frequencies are blocked anyway.
Digital Signal Processing, Digital Signal Processing, 2007 Robi Polikar, Rowan University 2007 Robi Polikar, Rowan University
Linear Phase Filters
Linear Phase Filters
It is typically impossible to design a linear phase IIR filter, however,
designing FIR filters with precise linear phase is very easy:
Consider a causal FIR filter of length M+1 (order M)
This transfer function has linear phase, if its impulse response h[n] is either
symmetric
or anti-symmetric
M
N
n
n
z M h z h z h h z n h z H
=
+ + + + = =
] [ ] 2 [ ] 1 [ ] 0 [ ] [ ) (
2 1
0
M n n M h n h = 0 ], [ ] [
M n n M h n h = 0 ], [ ] [
LINEAR PHASE FILTERS
A linear phase solution for the causal FIR filter function
0
( ) [ ]
N
n
n
H z h n z
=
=
( ) ( )
j j
H e H e
=
requires: where c and are constants and
is the amplitude response (zero-phase response), a real function of
( )
( ) ( )
j j c
H e e H
+
=
( ) H
+
=
= =
LINEAR PHASE FILTERS
the anti-symmetric case then is:
( )
0
( ) [ ]
N
j c l
l
H h l e
+
=
=
+
=
=
[ ] [ ], 0 h n h N n n N =
2
N
c =
For odd this becomes: ( ) H
[ ] [ ], 0 ,
2
N
h n h N n n N c = =
LINEAR PHASE FILTERS
This linear phase filter description can be generalised into a formalism
for four type of FIR filters:
Type 1: symmetric sequence of odd length
Type 2: symmetric sequence of even length
Type 3: anti-symmetric sequence of odd length
Type 4: anti-symmetric sequence of even length
LINEAR PHASE FILTERS
It is possible to generate other type of FIR transfer function from a given
type transfer function. Take a given type I transfer function H(z).
From this function we can generate at least three types of other functions:
/ 2
/ 2
/ 2 / 2
( ) ( )
( ) ( 1) ( )
( ) ( 1) ( )
N
N
N N
E z z H z
F z H z
G z z H z
=
=
=
( ) ( )
( ) 1 ( )
( ) 1 ( )
E H
F H
G H
=
=
=
with amplitude
responses:
- if H(z) is a lowpass (bandpass) transfer function,
then E(z) is a highpass (bandstop) transfer function; and vice versa.
- F(z) is of the same type as H(z), but with different width.
- G(z) is of the same type as E(z), but with different width.
Digital Signal Processing, Digital Signal Processing, 2007 Robi Polikar, Rowan University 2007 Robi Polikar, Rowan University
Linear Phase Filters
Linear Phase Filters
There are four possible scenarios: filter length even or odd, and
impulse response is either symmetric or antisymmetric
FIR II: even length, symmetric
FIR I: odd length, symmetric
FIR III: odd length,
antisymmetric
FIR IV: even length,
antisymmetric
Note for this case
that h[M/2]=0
Digital Signal Processing, Digital Signal Processing, 2007 Robi Polikar, Rowan University 2007 Robi Polikar, Rowan University
FIR I and FIR II Types
FIR I and FIR II Types
For symmetric coefficients, we can show that the frequency responses are of the
following form:
FIR II (M is odd, the sequence is symmetric and of even length)
Note that this of the form H()=e
-j
G(), where =M/2, and G() is the real quantity (the
summation term)Output is delayed by M/2 samples!
FIR I (M is even, sequence is symmetric and of odd length)
Again, this system has linear phase (the quantity inside the parenthesis is a real quantity) and
the phase delay is M/2 samples.
( )
2 1
0
2
2
cos ] [ 2 ) (
M
i
M
j
i
M
i h e H
G()
+ =
=
2
1
2
2
cos ] [ 2 ]
2
[ ) (
M
i
M
j
i
M
i h
M
h e H
Digital Signal Processing, Digital Signal Processing, 2007 Robi Polikar, Rowan University 2007 Robi Polikar, Rowan University
FIR III and FIR IV Types
FIR III and FIR IV Types
For antisymmetric sequences, we have h[n]=-h[M-n], which gives us sin terms in
the summation expression:
FIR IV (M is odd, the sequence is antisymmetric and of even length)
FIR III (M is even, the sequence is antisymmetric and of odd length)
In both cases, the phase response is of the form ()=-(M/2) + /2, hence generalized
linear phase. Again, in all of theses cases, the filter output is delayed by M/2 samples. Also,
for all cases, if G()<0, an additional term is added to the phase, which causes the samples
to be flipped.
( )
+ 2 1
0
2 2
2
sin ] [ 2 ) (
M
i
M
j
i
M
i h e H
+
1 2
1
2 2
2
sin ] [ 2 ) (
M
i
M
j
i
M
i h e H
Digital Signal Processing, Digital Signal Processing, 2007 Robi Polikar, Rowan University 2007 Robi Polikar, Rowan University
An Example
An Example
Matlab Demo
Matlab Demo
%Plot the zero - pole plots
figure
subplot(221)
zplane(h1,1); grid
title('FIR 1')
subplot(222)
zplane(h2,1);grid
title('FIR 2')
subplot(223)
zplane(h3,1);grid
title('FIR 3')
subplot(224)
zplane(h4,1);grid
title('FIR 4')
h1=[1 2 3 4 3 2 1]; % FIR 1
h2=[1 2 3 4 4 3 2 1]; % FIR 2
h3=[-1 -2 -3 0 3 2 1]; %FIR 3
h4=[-1 -2 -3 -4 4 3 2 1] ; % FIR 4
[H1 w]=freqz(h1, 1, 512); [H2 w]=freqz(h2, 1, 512);
[H3 w]=freqz(h3, 1, 512); [H4 w]=freqz(h4, 1, 512);
% Plot the magnitude and phase responses
% in angular frequency from 0 to pi
subplot(421); plot(w/pi, abs(H1));grid; ylabel('FIR 1')
subplot(422); plot(w/pi, unwrap(angle(H1)));grid;
subplot(423); plot(w/pi, abs(H2));grid; ylabel('FIR 2')
subplot(424); plot(w/pi, unwrap(angle(H2)));grid;
subplot(425); plot(w/pi, abs(H3));grid; ylabel('FIR 3')
subplot(426); plot(w/pi, unwrap(angle(H3)));grid;
subplot(427); plot(w/pi, abs(H4));grid
xlabel('Frequency, \omega/\pi'); ylabel('FIR 4')
subplot(428); plot(w/pi, unwrap(angle(H4)));grid
xlabel('Frequency, \omega/\pi')
lin_phase_demo2.m
Digital Signal Processing, Digital Signal Processing, 2007 Robi Polikar, Rowan University 2007 Robi Polikar, Rowan University
Zeros & Poles of an FIR Filter
Zeros & Poles of an FIR Filter
Example
Example
Zero at =/2
Zero at =
Zero at =7/10
not on unit circle!
Zero at =0 and =
on unit circle!
Digital Signal Processing, Digital Signal Processing, 2007 Robi Polikar, Rowan University 2007 Robi Polikar, Rowan University
Zero Locations of
Zero Locations of
Linear Phase Filters
Linear Phase Filters
For linear phase filters, the impulse response satisfies
We can make the following observations as facts
=
= =
M
n
n
z n M h z H n M h n h
0
) ( ) ( ] [ ] [ ) ( ) (
1
= z H z z H
M
1. If z
0
is a zero of H(z), so too is 1/z
0
=z
0
-1
2. Real zeros that are not on the unit circle, always occur in pairs
such as (1-z
-1
) and (1-
-1
z
-1
), which is a direct consequence of
Fact 1.
3. If the zero is complex, z
0
=e
j
, then its conjugate e
-j
is also
zero. But by the above statements, their symmetric
counterparts
-1
e
j
and
-1
e
-j
must also be zero. So, complex
zeros occur in quadruplets
4. If M is odd (filter length is even), and symmetric (that is,
h[n]=h[M-n]), then H(z) must have a zero at z=-1
5. If the filter is antisymmetric, that is, h[n]=-h[M-n], then H(z)
must have a zero at z=+1 for both odd and even M
6. If the filter is symmetric and h[n]=-h[M-n], and M is even, then
H(z) must have a zero at z=-1
?
Why? (p. 376)
Digital Signal Processing, 2010 Robi Polikar, Rowan University
Linear Phase Filter
Zero Locations
1 1
Type 2 Type 1
1 1
1
1
Type 4 Type 3
1 1
Type 1 FIR filter: Either an even
number or no zeros at z = 1 and
z=-1
Type 2 FIR filter: Either an even
number or no zeros at z = 1, and
an odd number of zeros at z=-1
Type 3 FIR filter: An odd number of
zeros at z = 1 and and z=-1
Type 4 FIR filter: An odd number of
zeros at z = 1, and either an even
number or no zeros at z=-1
The presence of zeros at z=1
leads to some limitations on the use of
these linear-phase transfer functions
for designing frequency-selective filters
Digital Signal Processing, 2010 Robi Polikar, Rowan University
A Type 2 FIR filter cannot be used
to design a highpass filter since it
always has a zero at z=-1
A Type 3 FIR filter has zeros at
both z = 1 and z=-1, and hence
cannot be used to design either a
lowpass or a highpass or a
bandstop filter
A Type 4 FIR filter is not
appropriate to design a lowpass
filter due to the presence of a zero
at z = 1
Type 1 FIR filter has no such
restrictions and can be used to
design almost any type of filter