Discrete -Time Signals and Systems Z-Transform-FIR filters · 2020. 3. 9. · 2 , st st st nd nd x...
Transcript of Discrete -Time Signals and Systems Z-Transform-FIR filters · 2020. 3. 9. · 2 , st st st nd nd x...
Yogananda Isukapalli
Discrete - Time Signals and Systems
Z-Transform-FIR filters
FIR filters-Review
0 [ ] [ . ]..
M
kk
general difference equation for FIR fiy ln b x ten rsk=
= -å
Filter Order = M: No. of memory blocks required in the filter implementation
Filter Length, L = M+1: Total No. of samples required in calculating the output, M from memory (past) and one present sample
Filter coefficients {bk}: Completely defines an FIR filter. All the properties of the filter can be understood through the coefficients
(
' '
) [ ]
( ) ( )( )
(
[ ] ,
) ( )
' '
n
n
system funcZ transform of impulse response h n results in
it is also known as
From the previous lecture recall that Transfer funct
transferfunctio
H z h n z
Y zH zX z
ion
tion
H X
n
Y z z
-=
=
Þ =
-
å
( )
[ ] [
] ( )
( )
Notice the mathematical simplicity of the above resultConvolution becomes a simple multiplic
z
h n x n Hati n
zo
X z* «
0
1)
( ) [ ]
( ) [
[ ]
2) [ ]
3) ( ) ( ) )
]
( )4
n
n
Mn
n
Find the Z transform of input signal x n
Find the Z transform of impulse response h n
Multip
X z
ly X z and
Ste
H
x n z
H z h
ps involve
z to get Y zObtai
n z
d
¥-
=-¥
-
=
-
=
=
-
å
å
1
[ ]
[ ]
( )
( )
n output y n by applying inverse Z transform to Y
y n Y z
z-
¬¾¾®
-! -
Calculating the output of a FIR filter using Z transforms-
Why to operate in transforms?Z-TRANSFORM-DOMAIN
FREQ-DOMAIN
kjM
kk
j ebeH ww ˆ
0
ˆ )( -
=å=
TIME-DOMAIN
å=
-=M
kk knxbny
0][][
}{ kb0
( ) [ ] M
n
nH z h n z-
== å
ˆˆ
ˆ
( ) ( )
,
jj
z ej
H e H z
z e makes both domains equal
ww
w=
=
\ =
Fig 12.1
y[n]x[n]
y[n]x[n] å -=n
njj enheH ww ˆˆ ][)(ww ˆˆ 1)( jj eeH --=
]1[][][ --= nnnh dd
y[n]x[n] 1( ) 1H z z-= -( ) [ ] n
nH z h n z-=å
Same output from all three domainsComputational complexity determines the domainSome of the filter properties are better understood in frequency or Z-domainsZ and frequency transforms are related
x[n] y[n]
Fig 12.2
Example 1
- ,{ [ ]} {2,0, 3,0,2}
Calculating the transfer function of the FIR filter withimpulse response co efficients given byh n = -
1 2 3 4
1 2 3 4
2
4
0
4
( ) [0]
{ [ ]} {2,0, 3,
[1] [2] [3] [4]
2 0 3 0 2
0, 2}
( ) [
2 3 2
] n
n
H z h h z h z h
h n
z h z
z z z z
z
H z h n z
z
- - - -
- - - -
- -
-
=
= + + + +
= + - - +
= - +
= -
= å
[ ] [ ] 2 [ -1] -3 [ - 2] - 4 [ - 3]
Calculating the transfer function of the FIR filter describedby the difference equation y n x n x n x n x n= +
{ }
1 2 3
1 2 3
3
0
( ) [0] [1] [2] [3]
[ ][ ] 1,2, -3, -4
(
1 2
) [
3 4
]
k
n
n
H z h h
h n b
h n
H
z h z h z
z
h z
z
z n
z
- - -
-
-
=
- -
= + + +
= + - -
=
=
= å
Example 2
[ ] [ -1] - [ - 2] [ -3] - [ - 4][ ] [ ] 2 [ -1] 3 [ - 2] 4 [ -3]
Calculating the output of the FIR filterx n n n n nh n n n n n
d d d dd d d d
= += + + +
Example 3
( )( )
0
1 2 3 4
1 2 3
0
1 2 3 4 1 2 3
[ - ]
( ) ( ) ( )
= 1
( )
( )
3
2 4
2 4
1 3
z nn n z
Y z
X z
X z H z
z z z z
z z z z
H z
z z
z
z
z z
d -
- - - - -
- -
- -
-
-
-
-
-=
¬¾®
=
- + - + +
- + -
= + +
+
+
!
!
10
1 2 3 4
5 6 7
01
1 2 3 4 5 6 7
2
= ( 1 2) (1 2 3) ( 1 2 3 4)
+( 2 3 4) ( 3 4) ( 4)
[ - ]
( ) 2
= 2 2 3 4
n
Apply the inverse Z tran
z z z z
z z z
zsf
z n n
Y z z z z
orz z z z z z
m
d--
-
- - - -
- - -
- - - - -
-
-
-
-
+ - + + - + + - + - +
- + - + - + + -
+ + +
¬¾¾®
= +
- + --
+
!-Z
3 4 5 6 72 3 4[ ] [ -1] [ - 2] 2 [ -3] 2 [ - 4] 3 [ -5]
[ - 6] 4 [ - 7]
z z z zy n n n n n n
n nd d d d dd d
- - - -+ - + -= + + + -+ -
Example 4
[ ] [ - 2][ ] [ ] 2 [ -1] 3 [ - 2] 4 [ -3]
Find the impulse response of the FIR filterx n ny n n n n n
dd d d d
== + + +
00
1 2 32
2
1
12
2 3
[ - ]
( )( )( )
1 2 3 4
( )
[ ] [ 2] 2 [ 1] 3 [ ] 4 [
( ) 1 2 3 4
-1]...
= 2 3 4
z n
h n n n n n non causa
X z z
Y z z
n n z
Y zH zX z
z z z z
l
z
z
z
z
z
d d
d
d d
-
-
-
- - -
- --
-
¬¾®
=
+ +
= + + + +
+= +
+ +
+
= +
+
=
+
!
!
Example 5
( )n
0 4
[ ]0
1 2 0 3[ ]0
Calculating the output of the FIR filter
A nx n
elsewhere
nh nelsewhere
£ £=
£ £=
41 2 3 4
0
( ) [ ]
(1 )
( ) [ ]
n
n
n
n
n
n
X z x n z
Az A z z z z
H z h n z
¥-
=-¥
- - - - -
=¥
-
=-¥
=
= = + + + + +
=
å
å
å
( )
( ) ( ) ( )
( ) ( ) ( )
( ) ( ) ( ) ( )( ) ( ) ( )
1 2 3 4 1 2 3
3 n
01 2
1 2 3 4
5 6
3
7
= (1 )(1 1 2 1 4 1 8 )
( ) ( ) ( )
(1 3 2 7 4 15 8 15 8
7 8 3
1 2
(1
8
1 2 1 4
[
1 8 )
(
8 )
]
1
n
n
A z z z z z z z
Y z H z X z
A z z z
z
z z z
z z
y n
z
A
z
- - - - - - -
- - - -
- - -
-
=- - -
+ + + + + + + +
= =
= +
=
= + + + +
+
+
+
+
+
=
å
!
( ) ( ) ( )( ) ( ) ( )( )
[ ] 3 2 [ 1] 7 4 [ 2] 15 8 [ 3]
+ 15 8 [ 4] 7 8 [ 5] 3 8 [ 6]
1 8 [ 7])
n n n n
n n n
n
d d d d
d d d
d
+ - + - + -
- + - + -
+ -
Cascading Systems
[ ]...
[ ]...
[ ]... 2
[ ]... 2 ,
st
st
st nd
nd
x n input signal to the 1 FIRfilter
h n impulse response of the 1 FIRfilter
w n output of the 1 FIR filter and input to the FIR filter
y n output of the filter also this is th e overall output
1 1 22 ( ) ( )[ ] [ )] [ (] zh n h n h n H z H z H z¬ =¾®= *
( )Cascaded system can be replaced by a single filter with system function H z
Fig 12.3
Fig 12.4
Example 1
1
2
[ ] [ ] [ 1][ ] [ ] [ 1]
The impulse responses in a cascaded system areh n n nh n n nFind the impulse response of an effective system thatcan replace the cascading arrangement
d dd d
= - -= + -
( )( )
00
1 1 2 21
11
21 1 2
1 2
( ), ( )
( ) 1
( ) 1
( ) ( ) 1 1 1
[ ] [
[ - ]
[ ] [
(
[ 2]
]
)
]
z n
z zH z H z
H z z
H z z
H z H z z z z
n n z
h n h n
H
n n
z
h n d
d
d
-
-
-
- - -
= -
= +
= - + -
¬¾®
¬¾® ¬¾®
-
= =
= -
!
Example 2
[ ] 3 [ ] [ 1][ ] 2 [ ] [ 1]
Consider a system described by the difference equationsw n x n x ny n w n w nFind the impulse response of an effective system thatcan replace the cascading arrangement
= - -= - -
1 1
1
2 2
2
[ ] ( ) [3, 1][ ] 3 [ ] [ 1][ ] ( ) [2, 1][ ] 2 [ ] [ 1]
h n b kh n n nh n b kh n n n
d d
d d
= = -= - -= = -= - -
( )( )
00
1 1 2 21
11
21 1
1 2
1 2
( ), ( )
( ) 3
( ) 2
( ) ( ) 3 2
5
[ - ]
[ ] [ ]
( )
[ ] 6 [ ] 5 [ 1] [ 2] 6
z n
z zH z H z
H z z
H z z
H z H z z z
z z
h n n n nThe system can now be expressed as o
n n z
h
ne difference equat
n h n
H z
y
iond d
d
d
-
-
-
- -
- -
= -
= -
= - -
-
¬¾®
¬¾®
= - - + -
¬¾®
=
= +
!
[ ] 6 [ ] 5 [ 1] [ 2]n x n x n x n= - - + -
Example 3 ,
[ ] [ ] 2 [ 1] 2 [ 2] [ 3]
,[ ] [ ] [ 1]
st
The impulse response of an effective systemh n n n n nSplit the above filter into two cascaded filters such that
the 1 system is described byw n x n x n
d d d d= - - + - - -
= - -
00
1 2 3
11
1
[ - ]
( ) 1 2 2[ ] [ ] [ 1]
( ) 1
z nn n z
H z z z zh n n n
H z z
d
d d
-
- - -
-
¬¾®
= - + -= - -
= -
!
1 2
21
1 2 3
1
1 2
2
[ ] [ ]
( ) ( ) ( )( )( )( )
1 2 2 =1
=1[ ] [ ] [ 1] [ 2]
[ ] [ ] [ 1] [ 2][ 1]
H z H z H zH zH zH z
z z zz
z zh
Complete syste
n n n n
y n w n w n wm
w n xn
n x n
d d d
- - -
-
- -
=
=
- + --
- += - -
üý= -
+ -
=-- -
þ
- +
!
Fig 12.5
Example 4: Deconvolution
1
:
( ) ( )
Example Communication channel
Und
Cascading of filters has an important practical application
oing the effects of channel on signal is cal
Undoing the eff
led equaliza
ects of the first filter
Y z H
tion
z= 2
1 2
11
2 1
( ) ( )
( ) ( )
( ) ( ) 1
( ) 1
1( )
1
H z X z
if Y z X z
H z H z
Assume H z z
H zz
-
-
=
Þ =
= -
=-
Z-Transform & Unit circle
ˆ
ˆ
ˆ
ˆ
ˆ
,
, , ' '
ˆ
,
( ) ( )
1,
j
j
jz e
j
j
The general expression for Z is
z rewhere r
z e makes b
The frequency or doma
oth domains e
is the radi
qual
us of the cir
H e H z
z e the u
in is a subset of z do
nit
main
cle
w
w
w
w
w
w
=
=
=
=
=
- -
=! circle has a unique significance
in the z domain-
ˆ 2 ,
ˆ ' '
ˆ 1 1
Note that is the discrete time frequency discussed inprevious lectures
Periodicity in domain radians one cycle in z domainz
w p
w
p w p-- - - -
£ £ ¬
-
¾®- £ £
{ } , ,1,
ˆ ,0,2 2
Gray dots z j j
p pw
= -
ì ü= -í ýî þ
General Z plane-
ˆ , ˆ
jz e special casez domain domain
w
w=- = -
Fig 12.6
Zeros & Poles
( )1 2 3 3
3
3 2
3
3
3
1 2
1 2 2(
( ) 1 2 2 '
)
2 2 1
'
,
Consider the transfer function of an FIR filter
H z z z zConvert the above function as a po
write
z z
l
the numerator in fac
z zH z
zz
ynomial in z
tor
z z
ed foz
rm
z
-
- - -
- -
= - + -
- + -=
- + -=
2 3 32 2 1 ( 1)( )( )j jz z z z e z ep p-- + - = - - -
{ }
{ }
3 3
3
3 3
3
( 1)( )( )( )
,
( ) 0 1
, ,
( ) 0,0,0
....
.
0
( ) 0
..
s
( ).
j j
j j
z z e z eH
The values of z for which H z
The values of z for w
zz
In this example
H z for z e e
H z for z
note that z result in
hich H z
3
Zeros
Poles
p p
p p
-
-
- - -=
= =
=
®
=
¥
®
=
¥
0 3 rd
roots
It is also known as a order pole at z =
1 1z =
32
jz e
p
=
33
jz e
p-
=
3 poles
[ ] [ ],
:
Except for a constant FIRsystem is completelycharacterized byThe difference equationwhich desribes the relationbetween
Significance o
x n and
f ze
y
th
n
ros in a
ca
e ze
nFIR syste
nbe fou
o
m
r
nd
s
w
ith the knowledgeof zero locations
Fig 12.7
Example 1
2
1
1 2
1
2
2
2
' '
,
3 2 ( 2)( 1)[
?
, ] [2,
3 2
(
( )
1]
)
[ ,
1 3 2Converting into a polynomial in z
write the numerator in fact
Find the poles and zeros for the transfer fu
ored form
z z z zze
nction
H z z z
ros z z
pol
z zH z
e
z
s p
- -= -
- + = - -= =
=
+
- +=
2 ] [0,0] 2 0ndp order pole at z= = =
Example 1 continued…
Notice that both the zeros are on real axis, also notice onepole is not included in the unit circle. There is a double pole at z=0
Fig 12.8
Example 2
00
1 2
[ ] [ ] [ 1] [ 2
[ ] [ ] [ 1] [ 2]
[ - ]
) 1
]
(
z n
Theimpulseresponsefunctionisg
Find the poles and zeros of an FIR system describedby the di
Conv
fference equation,y n x n
ivenbyh n n n n
n n z
H z z zert
n
n
n
g
x
i
x
d d d
d -
- -
= - - + -
= - - + -
¬¾®
= - +
!
2
2
' '
1( )
into a polynomial in z
z zH zz- +
=
2 3 3
3 3
,
1 ( )( )
[ , ],
[0,0] 2 0
j j
j j
nd
write the numerator in factored form
z z z e z e
zeros e e both on unit circle
poles order pole at z
p p
p p
-
-
- + = - -
=
= = =
2 poles3p
3p-
Fig 12.9
Example 3
4
4 4 2
4
,
[ , ][0,
( )(
0]
)
2j j
j j
The zeros and poles of an FIR filter are given
zeros e epolesFind the difference equatThe numerator is obtained through multiplication of factors
ion of the filte
z e z e z z
r
p
p p
p-
-
- - = -
==
2
2
2
1
,
2 1( )
denominator through poles z
z zH zz
+
- +=
1 2
1 2
,
[ ] [ ] 2
[ 1] [ 2]
[ ] [ ] 2 [ 1
] [ 2]
z zApply inverse Z transform
h n n n nThe difference equation
y n x n x n x n
d d d
- -= - +-
= - - + -
= - - + -
4p
Notice that, becauseof conjugate zerosa sinusoid signal withfrequency will benulled out by this FIRfilter
4p
Fig 12.10
Example 4, Application: Nulling filtersThe Graphical Design of a Comb filter
• In medical applications, the 60Hz frequency of the power supply is often “picked up” by the test equipment (EKG recorder)
• Also harmonically related frequencies such as f2 = 2x60 = 120Hz, and f3 = 3x60 = 180 Hz are generated because of non-linear phenomena.
• The object of a digital filter design is to eliminate or suppress these unwanted frequencies which distort or mask up the signals of interestThus the desired response of the filter would be, Assume a sampling frequency of 360Hz
0 60 120 180 f Hz
p/3 2p/3 p q rad
M
Fig 12.11
Thus we have :
q1 = w1T = 2p(60)/360 = p/3
q2 = w2T = 2p(120)/360 = 2p/3
q3 = w3T = 2p(180)/360 = p
1) Complex zeros must occur in conjugate pairs
2) q = 0 is added to eliminate any DC component in the signal
0 60 120 180 f Hz
p/3 2p/3 p q rad
Actual Response
Fig 12.12
But the above obtained filter is non-causal !! To make it causal filter we place six poles at z = 0.
Thus the required causal FIR comb filter is:
]6[][][ --= nxnxny
)1()(1)( 6
6
6-=\Þ-
= -zzHzzzH
Implies : ][]6[][ -+= nxnxny
1)(
))()()()()(1()(6
35
34
32
3
-=
------=
zzH
ezezezezezzzHjjjjjpp
ppp
Filter properties & the location zerosThere is an extremely close relationshipbetween the frequency response of the filterand the location of zeros on the unit circle
One can design a filter with required frequencyby placing zeros in the appropriate place. The difference equation of the filter can be obtainedby multiplying the factors associated with zeros
Example: Running average filter
( )
1
0
1
2
10
1
[ ] [ ]
1( )1
1 1
.. ,
1 0
, 0,1,2... 1
L
k
LLk
k
L
j
L
k L
L
y n x n k
The system function
zH z zz
Zeros from numerator
zz
z
z k
z
e Lp
-
=
---
-=
-
= -
-= =
-
- =
= =
-=
-
-
å
å
1
1
.. ,
( 1) 0
0, 1
0
1
1
L
L th
Poles from numerator
z z
z L order pole atAnd anoNot
Zeros are equally spaced around th
e that this pole and zerother pole at z
at z get cancell
e cir
e
cl
d
e
-
-
- =
=
=
-=
1
The primary reason for the filter to become a lowpassfilter is this cancellation of the zero at z dueto the pole present in the same location
=
111
ExampleLRunning average filter=
1
Equi spaced zerosMore gap bewteen zerosclose to z =
Fig 12.13
Fig 12.14
3 dimensional view of the frequency response
( )1
2 1
1
,
, ( ) 1L
j k L
k
If the zeros locations are known the transfer function
of the filter can be obtained through H z e zp-
-
== -Õ
Fig 12.15
210
ExampleLRunning average filter=
9 0 1
th order pole at zMore gap bewteen zerosclose to z
=
=Fig 12.16
Fig 12.17
310
ExampleLBand pass filter=
01 2
0
0
;
( )
:
.
s
Lj k k Lk
k
cancel the zero ina different locationTransfer function shifts
H z z e
k determines theshift
Since there isno conjugatezero this resultin a complex fil
A simple tr
t
ck
e
i
r
p-
-
== å
! Fig 12.18
Fig 12.19
0
0
1 2
1 2
01 2
0
( ) ( ) ( )
1( )21 2
s in
Lj k k Lk
kL
j k k Lk
k
H z H z H z
same exampledue to conjugate symmetrythis result a filter withreal coeffici
H z z e
z
nts
e
e
p
p
--
=-
--
=
= +
= +å
å
Fig 12.20
Fig 12.21
Notice changes in theimpulse response h[n] and the frequency response as the complex zero pair is moved around the unit circle (changing the angle of the zeros)
ˆ[ ] [ ] 2cos( ) [ 1] [ 2]h n n n nd w d d= - - + -
FIR filter with two zeros
Fig 12.22
FIR filter with three zeros; one is held fixed at z = -1
Notice changes in the impulse responseh[n] and the frequency response as the complex zero pair ismoved around the unitcircle (changing angle)
Fig 12.23
FIR filter with ten zeros equally spaced around the unit circle
Notice changes in the impulseresponse h[n]and the frequencyresponse as the zero at z = 1,is moved radially
Fig 12.24
FIR filter with ten zeros equally spaced around the unit circle
Notice changes in the impulse response h[n] and the frequencyresponse as the zero pair at 72 degrees is moved radially.
Fig 12.25
James H. McClellan, Ronald W. Schafer and Mark A. Yoder, “7.5-7.8 --Signal Processing First”, Prentice Hall, 2003
Reference