prof. brian l. evans dept. of electrical and computer engineering the university of texas at austin...
Post on 13-Dec-2015
216 Views
Preview:
TRANSCRIPT
Prof. Brian L. Evans
Dept. of Electrical and Computer Engineering
The University of Texas at Austin
EE345S Real-Time Digital Signal Processing Lab Fall 2006
Lecture 5 http://courses.utexas.edu/
Finite Impulse Response Filters
5 - 2
Discrete-Time Impulse Signal
• Let [k] be a discrete-time impulse function, a.k.a. Kronecker delta function:
• Impulse response is response of discrete-time LTI system to discrete impulse functionExample: delay by one sample
• Finite impulse response filterNon-zero extent of impulse response is finite
Can be in continuous time or discrete time
Also called tapped delay line (see slides 3-13, 3-19, 5-3)
00
01
k
kk
1z[k] h[k]
]1[][ kkh
5 - 3
1
0
][ ][ ][M
m
mkxmhky
Discrete-time Tapped Delay Line
• Impulse response h[k] of finite extent k = 0,…, M-1
• Block diagram (finite impulse response filter)
z-1 z-1 z-1…
…
x[k]
y[k]
h[0] h[1] h[2] h[M-1]
x[k-1]
Discrete-time convolution
Applications of continuous-time tapped delay lines?
5 - 4
Discrete-time Convolution Derivation
• Output y[k] for input x[k]
• Any signal can be decomposedinto sum of discrete impulses
• Apply linear properties
• Apply shift-invariance
• Apply change of variables
y[k] = h[0] x[k] + h[1] x[k-1]
= ( x[k] + x[k-1] ) / 2k
h[k]
2
1
Averaging filter impulse response
0 1 2 3
kxTky
m
mkmxTky
mkTmxkym
mkhmxkym
mkxmhkym
5 - 5
Comparison to Continuous Time
• Continuous-time convolution of x(t) and h(t)
For each t, compute different (possibly) infinite integral
• In discrete-time, replace integral with summation
For each k, compute different (possibly) infinite summation
• LTI systemFrom impulse response and input, one can determine output
Impulse response uniquely characterizes LTI system
dtxhdthxthtxty
mkxmhmkhmxkymm
5 - 6
Convolution Demos
• Johns Hopkins University Demonstrationshttp://www.jhu.edu/~signals (http://www.jhu.edu/~signals)
Convolution applet to animate convolution of simple signals and hand-sketched signals
Convolving two rectangular pulses of same width gives triangle with width of twice the width of rectangular pulses(also see Appendix E for intermediate calculations)
t
1x(t)
0 Ts 2Ts
Ts
t
1h(t)
0 Ts
* = y(t)
Ts
t
5 - 7
Linear Time-Invariant Systems
• Complex exponentials zk havea special property when theyare input into LTI systems
• Output will be same complexexponential weighted by H(z)
• When we specialize the z-domain to frequency domain, magnitude of H(z) will control which frequencies are attenuated or passed
• H(z) is also known as the transfer function
)(
][
zHz
zmhz
zmh
zkhkfkhky
km
mk
m
mk
k
5 - 8
Linear Time-Invariant Systems
• The Fundamental Theorem of Linear SystemsIf a complex sinusoid were input into an LTI system, then
the output would be a complex sinusoid of the same frequency that has been scaled by the frequency response of the LTI system at that frequency
Scaling may attenuate the signal and shift it in phaseExample in continuous time: see handout FExample in discrete time. Let x[k] = e j k,
H() is discrete-time Fourier transform of h[k]H() is also called the frequency response
Heemhemheky kj
m
mjkj
m
mkj ][][][
H()
5 - 9
Frequency Response
• For continuous-time systems, response to complex sinusoid is
• For discrete-time systems, z-k = (r e j )–k = r-k e – j k and the response is
• For discrete-time systems, response to complex sinusoid is
jHtjHt
ejHe tjtj
cos cos
kk zzHz )(
cos cos
jj
kjjkj
eHkeHk
eeHe
frequency response
frequency response
5 - 10
Example: Ideal Delay
• Continuous TimeDelay by T seconds
Impulse response
Frequency response
• Discrete TimeDelay by 1 sample
Impulse response
Frequency response
)( Ttxty
Tx(t) y(t)
)( Ttth
TjeH
]1[][ kxky
1zx[k] y[k]
]1[][ kkh
jeH
1 || H
TH
1 || H
H
5 - 11
Frequency Response
• System response to complex sinusoid e j t for all possible frequencies where = 2 f :
• Above: passes low frequencies, a.k.a. lowpass filter• FIR filters are only realizable LTI filters that can
have linear phase over all frequencies• Not all FIR filters exhibit linear phase
|H()|
|H()|
p ss p
passband
stopband stopbandLinearphase
THd
ddelay
)()(
5 - 12
Linear Time-Invariant Systems
• Any linear time-invariant system (LTI) system, whether continuous-time or discrete-time, can be uniquely characterized by itsImpulse response: response of system to an impulse ORFrequency response: response of system to a complex
sinusoid (e j t or e j k) for all possible frequencies ORTransfer function: general transform of impulse response
(Laplace transform for continuous-time systems and z-transform for discrete-time systems)
• Given one, we can find other two if they existGive an impulse response that has a Laplace transform but
not a Fourier transform? What about the other way?
5 - 13
Mandrill Demo (DSP First)
• Five-tap discrete-time averaging FIR filter with input x[k] and output y[k]
Lowpass filter (smooth/blur input signal)Impulse response is {1/5, 1/5, 1/5, 1/5, 1/5}
• First-order difference FIR filter
Highpass filter (sharpensinput signal)
Impulse response is {1, -1}
]4[5
1]3[
5
1]2[
5
1]1[
5
1][
5
1 kxkxkxkxkxky
]1[][ kxkxky
k
h[k]
1
First-order difference impulse response
1
5 - 14
Mandrill Demo (DSP First)
• DSP First demos: http://users.ece.gatech.edu/~dspfirst• From lowpass filter to highpass filter
original image blurred image sharpened/blurred image
• From highpass to lowpass filteroriginal image sharpened image blurred/sharpened image
• Frequencies that are zeroed out can never be recovered (e.g. DC is zeroed out by highpass filter)
• Order of two LTI systems in cascade can be switched under the assumption that computations are performed in exact precision
5 - 15
Mandrill Demo (DSP First)
• Precision– Input is represented as eight-bit numbers [0,255] per image
pixel (i.e. fewer than three decimal digits of accuracy)
– Filter coeffients represented by one decimal digit each
– Intermediate computations (filtering) in double-precision floating-point arithmetic (15-16 decimal digits of accuracy)
– Output is represented as eight-bit number [-128, 127](i.e. fewer than three decimal digits)
• No output precision was harmed in the making of this demo
5 - 16
Finite Impulse Response Filters
• Duration of impulse response h[k] is finite, i.e. zero-valued for k outside interval [0, M-1]:
– Output depends on current input and previous M-1 inputs– Summation to compute y[k] reduces to a vector dot product
between M input samples in the vector and M values of the impulse response in vector
• What instruction set architecture features would you add to accelerate FIR filtering?
1
0
M
mm
mkxmhmkxmhkhkxky
)]1([ ..., ],1[ ],[ Mkxkxkx
]1[ ..., ],1[ ],0[ Mhhh
5 - 17
Symmetric FIR Filters
• Impulse response often symmetric about midpoint– Phase of frequency response is linear (slides 5-9 to 5-11)
– Example: three-tap FIR filter (M = 3) with h[0] = h[2]
• Implementation savings– Reduce number of multiplications from M to M/2 for even-
length and to (M+1)/2 for odd-length impulse responses
– Reduce storage of impulse response by same amount
– TI TMS320C54 DSP has an accelerator instructor FIRS to compute h[0] ( x[k] + x[k-2] ) in one instruction cycle
– On most DSPs, no accelerator instruction is available
]1[ ]1[]2[][]0[
]2[ ]2[]1[ ]1[][ ]0[
kxhkxkxh
kxhkxhkxhky
5 - 18
Filter Design
• Specify a desired piecewise constant magnitude response
• Lowpass filter example [0, p], mag [1-p, 1]
[s, ], mag [0, s]Transition band unspecified
• Symmetric FIR filter design methodsWindowingLeast squaresRemez (Parks-McClellan)
1
s
p
p s
Desired Magnitude Response
Passband StopbandTransition band
Red region is forbidden
Lowpass Filter Example
p passband ripple s stopband ripple
forbidden
forbidden
forbidden
Achtung!
5 - 19
Importance of Linear phase
• Speech signalsUse phase differences to
locate a speaker
Once locked onto a speaker, our ears are relatively insensitive to phase distortion in speech from that speaker (underlies speech compression systems, e.g. digital cell phones)
• Linear phase crucialAudio
Images
Communication systems
• Linear phase response Need FIR filters
Realizable IIR filters cannot achieve linear phase response over all frequencies
5 - 20
Z-transform Definition
• For discrete-time systems, z-transforms play same role as Laplace transforms do for continuous-time systems
Inverse transform requires contour integration over closed contour (region) R
Contour integration covered in a Complex Analysis course
• Compute forward and inverse transforms using transform pairs and properties
k
kzkhzH )(
Bilateral Forward z-transform
R
k dzzzHj
kh 1 )( 2
1][
Bilateral Inverse z-transform
5 - 21
Common Z-transform Pairs
• h[k] = [k]
Region of convergence: entire z-plane
• h[k] = [k-1]
Region of convergence: entire z-plane
h[k-1] z-1 H(z)
1 0
0
k
k
k
k zkzkzH
11
1
1 1
zzkzkzHk
k
k
k
1 if 1
1
00
z
a
za
z
aza
zkuazH
k
k
k
kk
k
kk
• h[k] = ak u[k]
Region of convergence: |z| > |a|
|z| > |a| is the complement of a disk
5 - 22
Region of Convergence• Region of the complex z-
plane for which forward z-transform converges
Im{z}
Re{z}Entire plane
Im{z}
Re{z}Complement of a disk
Im{z}
Re{z}Disk
Im{z}
Re{z}
Intersection of a disk and complement of a disk
• Four possibilities (z=0 is a special case that may or may not be included)
5 - 23
azza
kuaZ
k
for 1
1
1
Stability
• Rule #1: For a causal sequence, poles are inside the unit circle (applies to z-transform functions that are ratios of two polynomials) OR
• Rule #2: Unit circle is in the region of convergence. (For continuous-time signal, imaginary axis would be in region of convergence of Laplace transform.)
• Example:
Stable if |a| < 1 by rule #1 or equivalently
Stable if |a| < 1 by rule #2 because |z|>|a| and |a|<1
5 - 24
Transfer Function
• Transfer function is z-transform of impulse response; e.g. for FIR filter with M taps (slide 5-3)
Region of convergence is entire z-plane
FIR filters are always stable
• Substitute z = e j into transfer function to obtain frequency responseValid when unit circle is in region of convergence (i.e. for
stable systems according to rule #2 on last slide)
)1(11
0
]1[ ]1[]0[ )(
MM
k
k
k
k zMhzhhzkhzkhzH ...
)1( 1
0
]1[ ]1[]0[ |)()( jMjM
k
kj
ez
j eMhehhekhzHeH j
...
top related