ECE 421 Introduction to Signal Processing Dror Baron Assistant Professor Dept. of Electrical and Computer Engr. North Carolina State University, NC, USA
Digital Filter Design [Reading material: Chapter 10]
Big picture We ve discussed different types of filters Finite impulse response (FIR) Only zeros (no poles) Hopefully causal & stable Will use windowing techniques to convert ideal (infinitely long, noncausal) filter to practical Infinite impulse response (IIR) Uses poles for feedback Inspired by analog filter design 3
Linear Phase [Reading material: Section 10.1]
What and why? Recall HH ωω = + nn= h(nn)ee jjωωωω Phase Θ(ω)=<{H(ω)} Linear phase means Θ(ω)=a+bω Linear filter delays input by b samples Non-linear input will be distorted Will see what properties of h(n) correspond to linear phase 5
Active learning 1) Derive frequency response of h 1 (n)={+1,0,+1} 2) Explain why H 1 (ω) has linear phase 3) Ditto for h 2 (n)={-1,0,+1} 6
Symmetric filters Consider x(n)=x(-n) XX ωω = + nn= xx(nn)ee jjωωωω = xx 0 ee jjωω0 + + ll= xx(ll) ee jjωωωω + ee jjωω( ll) = xx 0 + 2 + ll= xx ll cos(ωωωω) Fourier response purely real-valued & symmetric (even) Phase 0 or π Example: h 1 ={+1,0,+1} H(ω)=2cos(ω) Phase linear with zero-slope 7
Anti-symmetric filters Consider x(n)=-x(-n) Note that x(0)=0 XX ωω = xx 0 ee jjωω0 + + ll= xx(ll) ee jjωωωω ee jjωω( ll) = 2jj + ll= xx ll ssin(ωωωω) Fourier response purely imaginary & anti-symmetric (odd) Phase -π/2 or π/2 Example: h 2 (n)={-1,0,+1} H(ω)= -2j sin(ω) 8
Finite Impulse Response Filters [Reading material: Section 10.2]
Symmetric vs. anti-symmetric Want FIR with linear phase M taps at times n=0, 1,, M-1 Symmetric: h(n)=h(m-1-n) H(ω)=H r (ω)e -jω(m-1)/2 Magnitude H r (ω) superposition of cosines Phase Θ ωω = ωω MM 1, HHHH ωω > 0 2 ωω MM 1 + ππ, HHHH ωω < 0 Asymmetric: h(n)=-h(m-1-n) Magnitude superposition of sines M odd middle tap @ (M-1)/2 contains zero 2 10
Highpass / lowpass / other? Asymmetric H r (ω) superposition of sines H r (0)=H r (π)=0 Bad for lowpass / highpass Feasible for bandpass Symmetric H r (ω) superposition of cosines H r (0), H r (π) could be nonzero Example: averaging filters They are symmetric and lowpass 11
FIR Design with Windowing
Key idea Start with desired freq response H d (ω) Convert to h d (n) Multiply by window w(n) Evaluate quality of resulting finite-duration h(n)=h d (n)w(n) Iterate (use different window) as needed H d (ω) F -1 h d (n) h(n) Evaluate w(n) reconsider window 13
Design criteria Choice of window involves: Symetric or anti-symmetric? Odd or even M? Trade-off between large M (many taps storage, computation, delay) and closeness to H d (ω) H d (ω) F -1 h d (n) h(n) Evaluate w(n) reconsider window 14
Impact of window structure Recall time domain product, h(n)=h d (n)w(n) Frequency domain convolution, H(ω)=H d (ω)*w(ω) HH ωω = 1 +ππ 2ππ HH dd νν WW ωω νν ddνν νν= ππ Note: will evaluate W(ω) at freqs outside (-π,+π); fine because it s periodic-2π 15
Example 1, nn {0,1,, MM 1} Start w/rectangular window, ww nn = 0, eeeeeeee Effect merely to truncate infinitely long h d (n) This is simplest possible window However Frequency response MM 1 WW ωω = ee jjωωωω = 1 ee jjωωωω sin(ωωωω/2) = ee jjωω(mm 1)/2 1 ee jjωω sin(ωω/2) nn=0 Magnitude response, WW ωω = sin(ωωωω/2) sin(ωω/2) Piecewise linear phase depends on sign of sin(ωωωω/2) sin(ωω/2) 16
Example continued (Matlab) Let s examine rectangular window numerically M1=31; % shorter window M2=61; % longer window w=1e-4:1e-3:pi; % frequencies being evaluated H1=sin(w*M1/2)./sin(w/2); H2=sin(w*M2/2)./sin(w/2); plot(w,log(abs(h1)),w,log(abs(h2))) 6 4 Does larger M help? Main lobe narrower/taller Main lobe same area But side lobes same height 2 0-2 -4-6 -8-10 -12 0 0.5 1 1.5 2 2.5 3 3.5 17
Considerations in window selection Want narrow main lobe quick transitions Want side lobes much lower clean transitions (less Gibbsstyle overshoots) Want side lobes to decay quickly 18
Some popular windows 1) Rectangular (no window) 2) Bartlett (triangular in time) Triangle = convolution of rectangles Each rectangle: width=(m+1)/2 Triangle: width=m Squared Dirichlet response Lower side lobes (2X in log scale) Main lobe 2X width 3) Hamming window Same 2X main lobe width Lower side lobes (3X in log scale) than rectangular 19
More windows 4) Hann Side lobes taper nicely But start higher (2X in log scale) Same 2X main lobe width 5) Blackman Wider main lobe (3X) Low side lobes (4X in log scale) 6) Kaiser: parametric family w/optimal trade-off between main lobe width & side lobe height 20
Design example Will design ideal LPF, HH dd ωω = ee jjωω(mm 1)/2, ωω < ωω cc 0, eeeeeeee Exponent term provides delay of (M-1)/2 samples, corresponding to middle of filter Time response, h dd nn = sin(ωω cc ππ(nn MM 1 2 )) ππ(nn MM 1 ωω cc ππ, nn MM 1 2 ) 2, nn = MM 1 2 Traditional rectangular window truncates to range n=0,, M-1 Suffers from Gibbs-style overshoots Larger M reduces width of overshoot but not amplitude 21
Design example continued To reduce oscillations of finite-duration filter, will use window: 1) Hamming: 2X wider main lobe, 3X side lobes ( smaller oscillations) 2) Hann: 2X wider, 2X lower side lobes, taper off better ( clean stop band) 3) Blackman: 3X wider, 4X lower side lobes The best solution depends on application Example1: want superb rejection of far-away (in freq) low-amplitude sinusoids in filtering application Hann Example2: want OK rejection of nearby sinuosoids Hamming Example3: want solid rejection of nearish sinusoids Blackman 22
Infinite Impulse Response Filters [Reading material: Section 10.3]
Main idea Design of analog filters (resistors, capacitors, inductors, ) has been around for decades Common approach to designing infinite impulse response (IIR) filters involves Design analog filter Convert to digital How to convert from analog to digital? 24
Rationale for filter conversion Recall (ECE 301 & 308) Laplace transfer function H(s) HH ss = BB(ss) AA(ss) = kk=0 MM bb kk ss kk NN aa kk ss kk kk=0 Corresponds to differential equation (continuous time) NN dd kk aa kk dddd kk yy tt = dd kk bb kk xx tt ddddkk kk=0 kk=0 Analogous to difference equation MM Stability requires poles on left hand side of s-plane Want jω-axis of s-plane to map to unit circle Want LHS of s-plans to map into unit circle 25
Conversion #1: approximating derivatives Time derivatives dddd dddd dddd dddd tt=nnnn xx nn xx(nn 1) TT and ddyy dddd approximated (using calculus) (sampling time T) Can show that s maps to 1 zz 1 TT HH zz = HH(ss = 1 zz 1 ) TT Good news: this conversion technique seems reasonable Bad news: jω-axis in s-plane mapped to circle of radius 0.5 centered around z=0.5 26
Conversion #2: sampling h(t) The analog filter s impulse response is h a (t) Let s sample, h(n)=h a (t=nt) Good news: also seems reasonable Bad news: aliasing-like artifacts 27
Conversion #3: bilinear transformation In study of functions of complex variables, bilinear transformations map circles to circles From jω-axis in s-plane (think of jω-axis as infinitely big circle) To unit circle in z axis Appropriate complex mapping is ss = 2 TT T is design parameter 1 zz 1 1+zz 1 1 ΩTT Can be computed using ωω = 2 tan 2 Analogous to how quickly we move along jω-axis Good news: LHS of s-axis maps to interior of unit circle in z 28
Example 10.3.4 ss+0.1 Consider analog filter HH aa ss = (ss+0.1) 2 +16 This is LPF whose resonance frequency (a.k.a. natural frequency in ECE 308) is Ω r =16 0.5 =4 Want to map resonance frequency to ω r =π/2 We do so by properly selecting T ωω rr = 2 tan 1 Ω rr TT 2 ππ 2 = 2 tan 1 4TT 2 tan ππ 4 = 1 = 4TT 2 = 2TT TT = 1 2 29
Example 10.3.4 continued Want to convert HH aa ss = Recall ss = 2 TT 1 zz 1 1+zz 1 = 4 1 zz 1 1+zz 1 ss+0.1 (ss+0.1) 2 +16 to H(z) Let s substitute: HH zz = HH aa ss = 4 1 zz 1 1+zz 1 = 4 1 zz 1 1+zz 1 +0.1 4 1 zz 1 2 1+zz 1 +0.1 +16 Can simplify this and turn into difference equation Extra credit challenge: do so on Moodle message board 30
Administrative Stuff
The final Midterms covered Chapters 1-5 Will cover 6-8, and 10 Material in chapters 8 & 10 only covered with easy questions Material covered in midterms will be de-emphasized Will try to put together interesting cross-cutting question Example: 2014 final showed fast algorithm for high precision multiplication via FFT Will plan final to require about as much work as Midterm #2 With 3 hours you should be OK Will likely have 2 questions similar to old tests / HW / Projects 32
Related courses Undergraduate ECE402 communication engineering; reliable transmission in presence of noise ECE420 wireless communication systems; applications of DSP & comm to wireless systems ECE492 special topics course highlighting applications of DSP Graduate ECE513 graduate level signal processing ECE514 random processes ECE515 digital communications ECE582 wireless communications ECE592 intro to data science (details in next slide) Several advanced 700-level courses 33
ECE 592 Newish graduate course (by Dror Baron) First offered fall 2016 Main theme: topics in data science Specific topics: Data structures & scientific programming Optimization Machine learning 101 Sparse signal processing Dimensionality reduction Individual project allows students to dig into topic of interest 34
Undergraduate research You perform research with faculty member & graduate student(s) Provides exposure to graduate-school style with reasonable time commitment Good for students potentially interested in graduate school yet unsure; or want to begin without diving into thesis research Makes sense for students who want to understand more or really master the material 35
The end 36