Lecture 10 FIR filter design - seas.ucla.eduseas.ucla.edu/~vandenbe/ee236a/lectures/filters.pdf ·...
Click here to load reader
-
Upload
truongdang -
Category
Documents
-
view
215 -
download
3
Transcript of Lecture 10 FIR filter design - seas.ucla.eduseas.ucla.edu/~vandenbe/ee236a/lectures/filters.pdf ·...
L. Vandenberghe EE236A (Fall 2013-14)
Lecture 10FIR filter design
• linear phase filter design
• magnitude filter design
• equalizer design
10–1
Finite impulse response (FIR) filter
y(t) =
n−1∑
τ=0
hτu(t− τ)
• u : Z → R is input signal; y : Z → R is output signal
• hi ∈ R are filter coefficients; n is filter order or length
frequency response: a function H : R → C defined as
H(ω) = h0 + h1e−jω + · · ·+ hn−1e
−j(n−1)ω (with j =√−1)
=
n−1∑
t=0
ht cos tω − j
n−1∑
t=0
ht sin tω
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 4 6 8 10 12 14 16 18 20
−0.2
−0.1
0
0.1
0.2
t
h(t)
frequency response: magnitude |H(ω)| and phase 6 H(ω)
0 0.5 1 1.5 2 2.5 310
−3
10−2
10−1
100
101
ω
|H(ω
)|
0 0.5 1 1.5 2 2.5 3−3
−2
−1
0
1
2
3
ω
6H
(ω)
FIR filter design 10–3
Linear-phase filters
suppose n = 2N + 1 is odd and impulse response is symmetric about hN :
ht = hn−1−t, t = 0, . . . , n− 1
frequency response
H(ω) = h0 + h1e−jω + · · ·+ hn−1e
−j(n−1)ω
= e−jNω (2h0 cosNω + 2h1 cos(N−1)ω + · · ·+ hN)
= 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 (±20 log10 δ1 in dB):
1/δ1 ≤ |H(ω)| ≤ δ1 for ω ∈ [0, ωp]
• minimum stopband attenuation (−20 log10 δ2 in dB):
|H(ω)| ≤ δ2 for ω ∈ [ωs, π]
FIR filter design 10–5
Linear-phase lowpass filter design
• sample the frequency axis: ωk = kπ/K, k = 0, . . . ,K − 1
• assume without loss of generality that G(0) > 0, so ripple spec. is
1/δ1 ≤ G(ωk) ≤ δ1
maximum stopband attenuation (for given passband ripple δ1)
minimize δ2subject to 1/δ1 ≤ G(ωk) ≤ δ1 for ωk ∈ [0, ωp]
−δ2 ≤ G(ωk) ≤ δ2 for ωk ∈ [ωs, π]
• a linear program in variables hi, δ2
• known and used since 1960’s
• can add other constraints, e.g., |hi| ≤ α
FIR filter design 10–6
Example
• linear-phase filter of order n = 31
• passband [0, 0.12π]; stopband [0.24π, π]
• maximum ripple δ1 = 1.059 (±0.5dB)
0 5 10 15 20 25 30−0.1
−0.05
0
0.05
0.1
0.15
0.2
t
h(t)
0 0.5 1 1.5 2 2.5 310
−4
10−3
10−2
10−1
100
101
ω
|H(ω
)|
FIR filter design 10–7
Variations
minimize passband ripple (variables δ1, h)
minimize δ1subject to 1/δ1 ≤ G(ωk) ≤ δ1 for ωk ∈ [0, ωp]
−δ2 ≤ G(ωk) ≤ δ2 for ωk ∈ [ωs, π]
minimize transition bandwidth (variables ωs, h)
minimize ωs
subject to 1/δ1 ≤ G(ωk) ≤ δ1 for ωk ∈ [0, ωp]−δ2 ≤ G(ωk) ≤ δ2 for ωk ∈ [ωs, π]
minimize filter order (variables N , h)
minimize Nsubject to 1/δ1 ≤ G(ωk) ≤ δ1 for ωk ∈ [0, ωp]
−δ2 ≤ G(ωk) ≤ δ2 for ω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
H(ω) =
n−1∑
t=0
ht cos tω − j
n−1∑
t=0
ht sin tω
• arises in many applications, e.g., audio, spectrum shaping
• not equivalent to linear inequalities in hi (linear inequalities can notexpress 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 = (h0, . . . , hn−1) ∈ Rn
rt =
n−1−t∑
τ=0
hτhτ+t (with hk = 0 for k < 0 or k ≥ n)
rt = r−t and rt = 0 for |t| ≥ n; hence suffices to specify r = (r0, . . . , rn−1)
Fourier transform of autocorrelation coefficients:
R(ω) =∑
τ
e−jωτrτ = r0 +
n−1∑
t=1
2rt cosωt = |H(ω)|2
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 = (r0, . . . , rn−1) as variable instead of h = (h0, . . . , hn−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 γ2subject to 1/γ1 ≤ R(ω) ≤ γ1 for ω ∈ [0, ωp]
R(ω) ≤ γ2 for ω ∈ [ωs, π]R(ω) ≥ 0 for ω ∈ [0, π]
(γi corresponds to δ2i in original problem)
discretization: impose constraints at finite set of frequencies ωk
minimize γ2subject to 1/γ1 ≤ R(ωk) ≤ γ1 for ωk ∈ [0, ωp]
R(ωk) ≤ γ2 for ωk ∈ [ωs, π]R(ωk) ≥ 0 for ωk ∈ [0, π]
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
h(t)g(t)
(time-domain) equalization
• given g (unequalized impulse response), gdes (desired impulse response)
• design FIR equalizer h so that convolution g̃ = h ∗ g approximates gdes
example
• gdes is pure delay D: gdes(t) =
{
1 t = D0 t 6= D
• find equalizer h by solving
minimize maxt 6=D
|g̃(t)|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
0 1 2 3 4 5 6 7 8 9−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
t
g(t)
• frequency response magnitude
0 0.5 1 1.5 2 2.5 310
−1
100
101
ω
|G(ω
)|
0 0.5 1 1.5 2 2.5 3−3
−2
−1
0
1
2
3
ω
6G(ω
)
FIR filter design 10–14
time-domain equalization (30th order FIR, D = 10)
minimize maxt 6=10
|g̃(t)|
• equalized system impulse response
0 5 10 15 20 25 30 35−0.2
0
0.2
0.4
0.6
0.8
1
t
g̃(t)
• equalized frequency response
0 0.5 1 1.5 2 2.5 310
−1
100
101
ω
|G̃(ω
)|
0 0.5 1 1.5 2 2.5 3−3
−2
−1
0
1
2
3
ω
6G̃(ω
)
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ω∈[0,π]
∣
∣ |G(ω)H(ω)|2 − 1∣
∣
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 Gk : [0, π] → C
• design FIR equalizer H so that |Gk(ω)H(ω)| ≈ constant:
minimize maxk=1,...,M
maxω∈[0,π]
∣
∣ |Gk(ω)H(ω)|2 − γk∣
∣
subject to γk ≥ 1, k = 1, . . . ,M
LP formulation: use autocorrelation coefficients as variables
minimize αsubject to
∣
∣ |Gk(ω)|2R(ω)− γk∣
∣ ≤ α for ω ∈ [0, π], k = 1, . . . ,M
R(ω) ≥ 0 for ω ∈ [0, π]γk ≥ 1, k = 1, . . . ,M
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
0 0.5 1 1.5 2 2.5 30
0.5
1
1.5
2
2.5
|Gk(ω
)|2
ω0 0.5 1 1.5 2 2.5 3
0
0.5
1
1.5
2
2.5
|Gk(ω
)H(ω
)|2
ω
FIR filter design 10–18