8/3/2019 Ch5.4_5
1/47
EE3054Signals and Syst em s
Lec t u re 2L inear and T im e Invar iant
Sys temsYao Wang
Poly tec hn ic Un iversi t y
Most of the slides included are extracted from lecture presentations prepared by
McClellan and Schafer
8/3/2019 Ch5.4_5
2/47
1/30/2008 2003, JH McClellan & RW Schafer 2
L ic ense In fo fo r SPFi rst Sl ides
This work released under a Creative Commons Licensewith the following terms:
Attribution The licensor permits others to copy, distribute, display, and perform
the work. In return, licensees must give the original authors credit.
Non-Commercial The licensor permits others to copy, distribute, display, and perform
the work. In return, licensees may not use the work for commercialpurposesunless they get the licensor's permission.
Share Alike The licensor permits others to distribute derivative works only under
a license identical to the one that governs the licensor's work.
Full Text of the License
This (hidden) page should be kept with the presentation
8/3/2019 Ch5.4_5
3/47
1/30/2008 2003, JH McClellan & RW Schafer 3
General FIR System IMPULSE RESPONSE
FIR case: h[n]=b_n
CONVOLUTION
For any FIR system: y[n] = x[n] * h[n]
Review o f Las t Lec t u re
][][][ nxnhny =
][nh
}{ kb
8/3/2019 Ch5.4_5
4/47
1/30/2008 2003, JH McClellan & RW Schafer 4
GENERAL FIR FILTER
FILTER COEFFICIENTS {bk}
DEFINE THE FILTER
For example,
=
=
M
k
k knxbny0
][][
]3[]2[2]1[][3
][][
3
0
++=
==
nxnxnxnx
knxbnyk
k
}1,2,1,3{ =kb
Feedforward Difference Equation
8/3/2019 Ch5.4_5
5/47
1/30/2008 2003, JH McClellan & RW Schafer 5
GENERAL FIR FILTER
SLIDE a Length-L WINDOW over x[n]
When h[n] is not symmetric, needs to flip h(n) first!
x[n]x[n-M]
8/3/2019 Ch5.4_5
6/47
1/30/2008 2003, JH McClellan & RW Schafer 6
7-pt AVG EXAMPLE
CAUSAL: Use Previous
LONGER OUTPUT
400for)4/8/2cos()02.1(][:Input ++= nnnx n
8/3/2019 Ch5.4_5
7/47
1/30/2008 2003, JH McClellan & RW Schafer 7
=
= 00
01
][ n
n
n
Uni t Im pulse Signa l
x[n] has only one NON-ZERO VALUE
1
n
UNIT-IMPULSE
8/3/2019 Ch5.4_5
8/47
1/30/2008 2003, JH McClellan & RW Schafer 8
},0,0,,,,,0,0,{][41
41
41
41
=nh
4-p t Avg Im pulse Response
[n] READS OUT the FILTER COEFFICIENTS
n=0h in h[n] denotes
Impulse Response
1
n
n=0
n=1
n=4
n=5
n=1
NON-ZERO
When window
overlaps [n]
])3[]2[]1[][(][41 +++= nxnxnxnxny
8/3/2019 Ch5.4_5
9/47
1/30/2008 2003, JH McClellan & RW Schafer 9
What is Im pulse Response?
Impulse response is the output signal when theinput is an impulse
Finite Impulse Response (FIR) system:
Systems for which the impulse response has finiteduration
For FIR system, impulse response = Filter
coefficients h[k] = b_k
Output = h[k]* input
8/3/2019 Ch5.4_5
10/47
1/30/2008 2003, JH McClellan & RW Schafer 10
FIR IMPULSE RESPONSE
Convolution = Filter Definition
Filter Coeffs = Impulse Response
=
=
M
k
knxkhny0
][][][
CONVOLUTION
=
=
M
k
k knxbny0
][][
8/3/2019 Ch5.4_5
11/47
1/30/2008 2003, JH McClellan & RW Schafer 11
Convolut ion Operat ion
Flip h[n]
SLIDE a Length-L WINDOW over x[n]
x[n]x[n-M]
=
=
M
k
knxkhny0
][][][
CONVOLUTION
8/3/2019 Ch5.4_5
12/47
1/30/2008 2003, JH McClellan & RW Schafer 12
More on s ignal ranges and
lengt hs a f t e r f i l t e r ing
Input signal from 0 to N-1, length=L1=N Filter from 0 to M, length = L2= M+1
Output signal?
From 0 to N+M-1, length L3=N+M=L1+L2-1
8/3/2019 Ch5.4_5
13/47
1/30/2008 2003, JH McClellan & RW Schafer 13
DCONVDEMO: MATLAB GUI
8/3/2019 Ch5.4_5
14/47
1/30/2008 2003, JH McClellan & RW Schafer 14
Go through the demo program for differenttypes of signals
Do an example by hand
Rectangular * rectangular
Step function * rectangular
8/3/2019 Ch5.4_5
15/47
1/30/2008 2003, JH McClellan & RW Schafer 15
CONVOLUTION via Synt het ic
Po lynom ia l Mul t ip l ic a t ion
8/3/2019 Ch5.4_5
16/47
1/30/2008 2003, JH McClellan & RW Schafer 16
Convolut ion v ia Synt het ic
Po lynom ia l Mul t ip l ic a t ion
More example
8/3/2019 Ch5.4_5
17/47
1/30/2008 2003, JH McClellan & RW Schafer 17
MATLAB fo r FIR FILTER
yy = conv(bb,xx)
VECTORbb contains Filter Coefficients
DSP-First: yy = firfilt(bb,xx)
FILTER COEFFICIENTS {bk} conv2()for images
=
=
M
k
k knxbny0
][][
8/3/2019 Ch5.4_5
18/47
1/30/2008 2003, JH McClellan & RW Schafer 18
]1[][][ = nununy
POP QUIZ
FIR Filter is FIRST DIFFERENCE
y[n] = x[n] - x[n-1]
INPUT is UNIT STEP
Find y[n]