L. Vandenberghe EE236A (Fall 2013-14)
Lecture 10 FIR filter design
linear phase filter design • magnitude filter design • equalizer design •
10–1 Finite impulse response (FIR) filter
n−1 y(t)= h u(t τ) τ − τX=0
u : Z R is input signal; y : Z R is output signal • → → h R are filter coefficients; n is filter order or length • i ∈ frequency response: a function H : R C defined as → H(ω) = h + h e−jω + + h e−j(n−1)ω (with j= √ 1) 0 1 ··· n−1 − n−1 n−1 = h cos tω j h sin tω t − t Xt=0 Xt=0 periodic and conjugate symmetric; we only need to consider ω [0,π] ∈ design problem: choose hi so that H satisfies/optimizes specifications
FIR filter design 10–2 Example: lowpass FIR filter impulse response (order n = 21)
0.2
0.1 )
t 0 ( h −0.1
−0.2
0 2 4 6 8 10 12 14 16 18 20 t frequency response: magnitude H(ω) and phase 6 H(ω) | |
1 10 3
2 0 |
10 )
) 1 ω ω
−1 ( 10 0 (
H −1
H −2 6
| 10 −2
−3 10 −3 0 0.5 1 1.5 2 2.5 3 0 0.5 1 1.5 2 2.5 3 ω ω
FIR filter design 10–3 Linear-phase filters
suppose n =2N +1 is odd and impulse response is symmetric about hN :
h = h , t =0,...,n 1 t n−1−t − frequency response
H(ω) = h + h e−jω + + h e−j(n−1)ω 0 1 ··· n−1 = e−jNω (2h cos Nω +2h cos(N 1)ω + + h ) 0 1 − ··· N = e−jNωG(ω)
term e−jNω represents N-sample delay • G(ω) is real-valued and H(ω) = G(ω) • | | | | ‘linear phase’: 6 H(ω) is linear except for jumps of π • ±
FIR filter design 10–4 Lowpass filter specifications
δ1
1/δ1
δ2
ωp ωs π ω
maximum passband ripple ( 20log δ in dB): • ± 10 1 1/δ H(ω) δ for ω [0,ω ] 1 ≤| |≤ 1 ∈ p
minimum stopband attenuation ( 20log δ in dB): • − 10 2 H(ω) δ for ω [ω ,π] | |≤ 2 ∈ s
FIR filter design 10–5 Linear-phase lowpass filter design
sample the frequency axis: ω = kπ/K, k =0,...,K 1 • k − assume without loss of generality that G(0) > 0, so ripple spec. is • 1/δ G(ω ) δ 1 ≤ k ≤ 1 maximum stopband attenuation (for given passband ripple δ1)
minimize δ2 subject to 1/δ1 G(ωk) δ1 for ωk [0,ωp] δ ≤G(ω ) ≤δ for ω ∈[ω ,π] − 2 ≤ k ≤ 2 k ∈ s a linear program in variables h , δ • i 2 known and used since 1960’s • can add other constraints, e.g., h α • | i|≤
FIR filter design 10–6 Example
linear-phase filter of order n = 31 • passband [0, 0.12π]; stopband [0.24π,π] • maximum ripple δ =1.059 ( 0.5dB) • 1 ±
0.2
0.15
0.1 )
t 0.05 (
h 0
−0.05
−0.1 0 5 10 15 20 25 30 t
1 10
0 10
−1
| 10 )
ω −2 10 (
−3 H 10 |
−4 10 0 0.5 1 1.5 2 2.5 3 ω
FIR filter design 10–7 Variations minimize passband ripple (variables δ1, h)
minimize δ1 subject to 1/δ1 G(ωk) δ1 for ωk [0,ωp] δ ≤G(ω ) ≤δ for ω ∈[ω ,π] − 2 ≤ k ≤ 2 k ∈ s minimize transition bandwidth (variables ωs, h)
minimize ωs subject to 1/δ1 G(ωk) δ1 for ωk [0,ωp] δ ≤G(ω ) ≤δ for ω ∈[ω ,π] − 2 ≤ k ≤ 2 k ∈ s minimize filter order (variables N, h) minimize N subject to 1/δ1 G(ωk) δ1 for ωk [0,ωp] δ ≤G(ω ) ≤δ for ω ∈[ω ,π] − 2 ≤ k ≤ 2 k ∈ s not LPs, but can be solved by bisection/LP feasibility problems
FIR filter design 10–8 Outline
linear phase filter design • magnitude filter design • equalizer design • Filter magnitude specifications magnitude specification: a constraint
L(ω) H(ω) U(ω) ω ≤| |≤ ∀ L,U : R R are given and → + n−1 n−1 H(ω)= h cos tω j h sin tω t − t Xt=0 Xt=0
arises in many applications, e.g., audio, spectrum shaping •
not equivalent to linear inequalities in hi (linear inequalities can not • express the lower bound on absolute value)
can change variables and convert to set of linear inequalities •
FIR filter design 10–9 Autocorrelation coefficients definition: autocorrelation coefficients of h =(h ,...,h ) Rn 0 n−1 ∈
n−1−t r = h h (with h =0 for k < 0 or k n) t τ τ+t k ≥ τX=0 r = r and r =0 for t n; hence suffices to specify r =(r ,...,r ) t −t t | |≥ 0 n−1 Fourier transform of autocorrelation coefficients:
n−1 R(ω)= e−jωτ r = r + 2r cos ωt = H(ω) 2 τ 0 t | | Xτ Xt=1 magnitude specifications are linear inequalities in coefficients rt:
L(ω)2 R(ω) U(ω)2 for ω [0,π] ≤ ≤ ∈
FIR filter design 10–10 Spectral factorization when is r Rn the vector of autocorrelation coefficients of some h Rn? ∈ ∈ spectral factorization theorem: if and only if R(ω) 0 for all ω ≥ condition is an infinite set of linear inequalities in r • many algorithms for spectral factorization (find h s.t. R(ω)= H(ω) 2) • | | consequence: to cast magnitude design problem as an LP,
use r =(r ,...,r ) as variable instead of h =(h ,...,h ) • 0 n−1 0 n−1 add spectral factorization condition as constraint: R(ω) 0 for all ω • ≥ discretize the frequency axis • optimize over r and use spectral factorization to recover h •
FIR filter design 10–11 Magnitude lowpass filter design maximum stopband attenuation design (with variables r)
minimize γ2 subject to 1/γ R(ω) γ for ω [0,ω ] 1 ≤ ≤ 1 ∈ p R(ω) γ2 for ω [ωs,π] R(ω) ≤ 0 for ω ∈[0,π] ≥ ∈
2 (γi corresponds to δi in original problem) discretization: impose constraints at finite set of frequencies ωk
minimize γ2 subject to 1/γ R(ω ) γ for ω [0,ω ] 1 ≤ k ≤ 1 k ∈ p R(ωk) γ2 for ωk [ωs,π] R(ω ) ≤ 0 for ω ∈[0,π] k ≥ k ∈ this is a linear program in r, γ2
FIR filter design 10–12 Outline
linear phase filter design • magnitude filter design • equalizer design • Equalizer design
g(t) h(t) (time-domain) equalization
given g (unequalized impulse response), g (desired impulse response) • des design FIR equalizer h so that convolution g˜ = h g approximates g • ∗ des example 1 t = D g is pure delay D: g (t)= • des des 0 t = D 6 find equalizer h by solving • minimize max g˜(t) t6=D | | subject to g˜(D)=1
this can be cast as an LP in the coefficients hi
FIR filter design 10–13 Example unequalized system (10th order FIR)
impulse response •
1
0.8
0.6
) 0.4 t
( 0.2 g 0
−0.2
−0.4 0 1 2 3 4 5 6 7 8 9 t
frequency response magnitude •
1 10 3
2 | )
) 1 ω
ω 0 10 ( 0 (
G −1 G 6 | −2
−1 10 −3 0 0.5 1 1.5 2 2.5 3 0 0.5 1 1.5 2 2.5 3 ω ω
FIR filter design 10–14 time-domain equalization (30th order FIR, D = 10)
minimize max g˜(t) t6=10 | |
equalized system impulse response •
1
0.8
) 0.6 t
( 0.4 ˜ g 0.2
0
−0.2 0 5 10 15 20 25 30 35 t
equalized frequency response •
1 10 3
2 | )
) 1 ω
ω 0 10 ( 0 ( e G
e −1 G 6 | −2
−1 10 −3 0 0.5 1 1.5 2 2.5 3 0 0.5 1 1.5 2 2.5 3 ω ω
FIR filter design 10–15 Magnitude equalizer design
H(ω) G(ω) problem
given system frequency response G : [0,π] C • → design FIR equalizer H so that G(ω)H(ω) 1: • | |≈ minimize max G(ω)H(ω) 2 1 ω∈[0,π] | | −
LP formulation: use autocorrelation coefficients as variables minimize α subject to G(ω) 2R(ω) 1 α for ω [0,π] | | − ≤ ∈ R (ω) 0 for ω [0,π] ≥ ∈ after discretizing the frequency axis, we obtain an LP in r and α
FIR filter design 10–16 Multi-system magnitude equalization problem
we are given M frequency responses G : [0,π] C • k → design FIR equalizer H so that G (ω)H(ω) constant: • | k |≈ 2 minimize max max Gk(ω)H(ω) γk k=1,...,M ω∈[0,π] | | −
subject to γ 1, k =1 ,...,M k ≥
LP formulation: use autocorrelation coefficients as variables
minimize α subject to G (ω) 2R(ω) γ α for ω [0,π], k =1,...,M | k | − k ≤ ∈
R(ω) 0 for ω [0 ,π] γ 1≥, k =1,...,M∈ k ≥ after discretizing the frequency axis, we obtain an LP in γk, r, α
FIR filter design 10–17 Example
M =2 systems, equalizer of order n = 25 • unequalized and equalized frequency responses •
2.5 2.5
2 2 2 | ) 2 ω |
1.5 ( 1.5 ) ω H ( ) k
1 ω 1 ( G | k G 0.5 | 0.5
0 0 0 0.5 1 1.5 2 2.5 3 0 0.5 1 1.5 2 2.5 3 ω ω
FIR filter design 10–18