Upload
others
View
5
Download
0
Embed Size (px)
Citation preview
1
ESE 531: Digital Signal Processing
Lec 16: March 20, 2018 Design of FIR Filters
Penn ESE 531 Spring 2018 – Khanna
Linear Filter Design
! Used to be an art " Now, lots of tools to design optimal filters
! For DSP there are two common classes " Infinite impulse response IIR " Finite impulse response FIR
! Both classes use finite order of parameters for design
! Today we will focus on FIR designs
3 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
What is a Linear Filter?
! Attenuates certain frequencies ! Passes certain frequencies ! Affects both phase and magnitude ! IIR
" Mostly non-linear phase response " Could be linear over a range of frequencies
! FIR " Much easier to control the phase " Both non-linear and linear phase
4 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
Filter Specifications
5 Penn ESE 531 Spring 2018 - Khanna
Impulse Invariance
! Let, ! If sampling at Nyquist Rate then
6 Penn ESE 531 Spring 2018 - Khanna
h[n]=Thc (nT )
H (e jω ) = Hc jωT−2πkT
⎛
⎝⎜
⎞
⎠⎟
⎡
⎣⎢
⎤
⎦⎥
k=−∞
∞
∑
Hc ( jΩ) = 0, Ω ≥ π /T
H (e jω ) = Hc jωT
⎛
⎝⎜
⎞
⎠⎟, |ω|<π
Bilinear Transformation
! The technique uses an algebraic transformation between the variables s and z that maps the entire jΩ-axis in the s-plane to one revolution of the unit circle in the z-plane.
7 Penn ESE 531 Spring 2018 - Khanna
2
Transformation of DT Filters
8 Penn ESE 531 Spring 2018 - Khanna
Z −1 =G(z−1)Hlp(Z)
! Z – complex variable for the LP filter ! z – complex variable for the transformed filter
! Map Z-plane#z-plane with transformation G
CT-Time Lowpass
CT Filters
! Butterworth " Monotonic in pass and stop bands
! Chebyshev, Type I " Equiripple in pass band and monotonic in stop band
! Chebyshev, Type II " Monotonic in pass band and equiripple in pass band
! Elliptic " Equiripple in pass and stop bands
! Appendix B in textbook
9 Penn ESE 531 Spring 2018 - Khanna
Design Comparison
! Design specifications " passband edge frequency ωp = 0.5π " stopband edge frequency ωs = 0.6π " maximum passband gain = 0 dB " minimum passband gain = -0.3dB " maximum stopband gain =-30dB
! Use Bilinear transformation to design DT low pass filter for each type
10 Penn ESE 531 Spring 2018 - Khanna
Butterworth
! Butterworth " Monotonic in pass and stop bands
11 Penn ESE 531 Spring 2018 - Khanna
Chebyshev
! Type I " Equiripple in pass band and
monotonic in stop band
! Type II " Monotonic in pass band and
equiripple in pass band
12 Penn ESE 531 Spring 2018 - Khanna
Elliptic
! Elliptic " Equiripple in pass and stop bands
13 Penn ESE 531 Spring 2018 - Khanna
3
Comparisons
14 Penn ESE 531 Spring 2018 - Khanna
What is a Linear Filter?
! Attenuates certain frequencies ! Passes certain frequencies ! Affects both phase and magnitude ! IIR
" Mostly non-linear phase response " Could be linear over a range of frequencies
! FIR " Much easier to control the phase " Both non-linear and linear phase
15 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
FIR GLP: Type I and II
16 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
FIR GLP: Type III and IV
17 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
FIR Design by Windowing
! Given desired frequency response, Hd(ejω) , find an impulse response
! Obtain the Mth order causal FIR filter by truncating/windowing it
18 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
Example: Moving Average
19
w[n]↔W (e jω ) =sin (N +1 2)ω( )sin ω 2( )
1M +1
w[n−M 2]↔W (e jω ) = e− jωM 2
M +1sin (M 2+1 2)ω( )
sin ω 2( )Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
4
Example: Moving Average
20 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
FIR Design by Windowing
! We already saw this before,
! For Boxcar (rectangular) window
21 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
FIR Design by Windowing
22 Penn ESE 531 Spring 2018 - Khanna
FIR Design by Windowing
23 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
Tapered Windows
24 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
Tradeoff – Ripple vs. Transition Width
25 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
5
Kaiser Window
26 Penn ESE 531 Spring 2018 - Khanna
! Near optimal window quantified as the window maximally concentrated around ω=0
! Two parameters – M and β
! α=M/2 ! I0(x) – zeroth order Bessel function of the first kind
Kaiser Window
! M=20
27 Penn ESE 531 Spring 2018 - Khanna
Kaiser Window
! M=20
28 Penn ESE 531 Spring 2018 - Khanna
Kaiser Window
! β=6
29 Penn ESE 531 Spring 2018 - Khanna
Approximation Error
30 Penn ESE 531 Spring 2018 - Khanna
FIR Filter Design
! Choose a desired frequency response Hd(ejω) " non causal (zero-delay), and infinite imp. response " If derived from C.T, choose T and use:
! Window: " Length M+1 ⇔ affects transition width " Type of window ⇔ transition-width/ ripple
31 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
6
FIR Filter Design
! Choose a desired frequency response Hd(ejω) " non causal (zero-delay), and infinite imp. response " If derived from C.T, choose T and use:
! Window: " Length M+1 ⇔ affects transition width " Type of window ⇔ transition-width/ ripple " Modulate to shift impulse response
" Force causality
32 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
FIR Filter Design
! Determine truncated impulse response h1[n]
! Apply window
! Check: " Compute Hw(ejω), if does not meet specs increase M or
change window
33 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
Example: FIR Low-Pass Filter Design
34 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
Example: FIR Low-Pass Filter Design
! The result is a windowed sinc function
! High Pass Design: " Design low pass " Transform to hw[n](-1)n
! General bandpass " Transform to 2hw[n]cos(ω0n) or 2hw[n]sin(ω0n)
35 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
Lowpass Filter w/ Kaiser Window
! Filter specs: " passband edge frequency ωp = 0.4π " stopband edge frequency ωs = 0.6π " Max ripple (δ) = .001
36 Penn ESE 531 Spring 2018 - Khanna
Lowpass Filter w/ Kaiser Window
! Filter specs: " passband edge frequency ωp = 0.4π " stopband edge frequency ωs = 0.6π " Max ripple (δ) = .001
37 Penn ESE 531 Spring 2018 - Khanna
7
Lowpass Filter w/ Kaiser Window
38 Penn ESE 531 Spring 2018 - Khanna
Lowpass Filter w/ Kaiser Window
39 Penn ESE 531 Spring 2018 - Khanna
Lowpass Filter w/ Kaiser Window
40 Penn ESE 531 Spring 2018 - Khanna
Characterization of Filter Shape
41 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
Time Bandwidth Product
42 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
Alternative Design through FFT
! To design order M filter: ! Over-Sample/discretize the frequency response at P
points where P >> M (P=15M is good)
! Sampled at: ! Compute h1[n] = IDFTP(H1[k]) ! Apply M+1 length window:
43 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
8
Example
44 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
Example
! For M+1=14 " P = 16 and P = 1026
45 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
Optimal Filter Design
! Window method " Design Filters heuristically using windowed sinc functions
! Optimal design " Design a filter h[n] with H(ejω) " Approximate Hd(ejω) with some optimality criteria - or
satisfies specs.
46 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
Optimality
! Least Squares:
! Variation: Weighted Least Squares:
47 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
Optimality
! Chebychev Design (min-max)
" Parks-McClellan algorithm - equiripple " Also known as Remez exchange algorithms (signal.remez) " Can also use convex optimization
48 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
Example of Complex Filter
! Larson et. al, “Multiband Excitation Pulses for Hyperpolarized 13C Dynamic Chemical Shift Imaging” JMR 2008;194(1):121-127
! Need to design 11 taps filter with following frequency response:
49 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
9
Least-Squares v.s. Min-Max
50 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley
Admin
! HW 7 " Out now " Due Friday 3/23
! Pick up midterm
51 Penn ESE 531 Spring 2018 – Khanna Adapted from M. Lustig, EECS Berkeley