Filter design

advertisement
Filter design
• FIR filters
• Chebychev design
• linear phase filter design
• equalizer design
• filter magnitude specifications
1
FIR filters
finite impulse response (FIR) filter:
y(t) =
n−1
�
τ =0
hτ u(t − τ ),
t∈Z
• (sequence) u : Z → R is input signal
• (sequence) y : Z → R is output signal
• hi are called filter coefficients
• n is filter order or length
Filter design
2
filter frequency response: H : R → C
H(ω) = h0 + h1e−iω + · · · + hn−1e−i(n−1)ω
=
n−1
�
t=0
• (EE tradition uses j =
√
ht cos tω + i
n−1
�
ht sin tω
t=0
−1 instead of i)
• H is periodic and conjugate symmetric, so only need to know/specify
for 0 ≤ ω ≤ π
FIR filter design problem: choose h so it and H satisfy/optimize specs
Filter design
3
example: (lowpass) FIR filter, order n = 21
impulse response h:
0.2
h(t)
0.1
0
−0.1
−0.2
0
2
4
6
8
10
12
14
16
18
20
t
Filter design
4
frequency response magnitude (i.e., |H(ω)|):
1
10
0
|H(ω)|
10
−1
10
−2
10
−3
10
0
0.5
1
1.5
2
2.5
3
2
2.5
3
ω
frequency response phase (i.e., � H(ω)):
3
H(ω)
2
1
0
�
−1
−2
−3
0
0.5
1
1.5
ω
Filter design
5
Chebychev design
minimize max |H(ω) − Hdes(ω)|
ω∈[0,π]
• h is optimization variable
• Hdes : R → C is (given) desired transfer function
• convex problem
• can add constraints, e.g., |hi| ≤ 1
sample (discretize) frequency:
minimize max |H(ωk ) − Hdes(ωk )|
k=1,...,m
• sample points 0 ≤ ω1 < · · · < ωm ≤ π are fixed (e.g., ωk = kπ/m)
• m ≫ n (common rule-of-thumb: m = 15n)
• yields approximation (relaxation) of problem above
Filter design
6
Chebychev design via SOCP:
where
minimize t�
�
(k)
(k)
subject to �A h − b � ≤ t,
A(k) =
�
�
1 cos ωk
0 −sin ωk
ℜHdes(ωk )
ℑHdes(ωk )


h0
h =  .. 
hn−1
b(k) =
Filter design
�
k = 1, . . . , m
· · ·
cos(n−1)ωk
· · · −sin(n−1)ωk
�
7
Linear phase filters
suppose
• n = 2N + 1 is odd
• impulse response is symmetric about midpoint:
ht = hn−1−t,
t = 0, . . . , n − 1
then
H(ω) = h0 + h1e−iω + · · · + hn−1e−i(n−1)ω
= e−iN ω (2h0 cos N ω + 2h1 cos(N −1)ω + · · · + hN )
Δ
� (ω)
= e−iN ω H
Filter design
8
• term e−iN ω represents N -sample delay
� (ω) is real
• H
� (ω)|
• |H(ω)| = |H
• called linear phase filter (� H(ω) is linear except for jumps of ±π)
Filter design
9
Lowpass filter specifications
δ1
1/δ1
δ2
ωp
ωs
π
ω
idea:
• pass frequencies in passband [0, ωp]
• block frequencies in stopband [ωs, π]
Filter design
10
specifications:
• maximum passband ripple (±20 log10 δ1 in dB):
1/δ1 ≤ |H(ω)| ≤ δ1,
0 ≤ ω ≤ ωp
• minimum stopband attenuation (−20 log10 δ2 in dB):
|H(ω)| ≤ δ2,
Filter design
ωs ≤ ω ≤ π
11
Linear phase lowpass filter design
• sample frequency
� (0) > 0, so ripple spec is
• can assume wlog H
� (ωk ) ≤ δ1
1/δ1 ≤ H
design for maximum stopband attenuation:
minimize δ2
� (ωk ) ≤ δ1, 0 ≤ ωk ≤ ωp
subject to 1/δ1 ≤ H
� (ωk ) ≤ δ2, ωs ≤ ωk ≤ π
−δ2 ≤ H
Filter design
12
• passband ripple δ1 is given
• an LP in variables h, δ2
• known (and used) since 1960’s
• can add other constraints, e.g., |hi| ≤ α
variations and extensions:
• fix δ2, minimize δ1 (convex, but not LP)
• fix δ1 and δ2, minimize ωs (quasiconvex)
• fix δ1 and δ2, minimize order n (quasiconvex)
Filter design
13
example
• linear phase filter, n = 21
• passband [0, 0.12π]; stopband [0.24π, π]
• max ripple δ1 = 1.012 (±0.1dB)
• design for maximum stopband attenuation
impulse response h:
0.2
h(t)
0.1
0
−0.1
−0.2
0
2
4
6
8
10
12
14
16
18
20
t
Filter design
14
frequency response magnitude (i.e., |H(ω)|):
1
10
0
|H(ω)|
10
−1
10
−2
10
−3
10
0
0.5
1
1.5
2
2.5
3
2
2.5
3
ω
frequency response phase (i.e., � H(ω)):
3
2
H(ω)
1
0
−1
�
−2
−3
0
0.5
1
1.5
ω
Filter design
15
Equalizer design
H(ω)
G(ω)
equalization: given
• G (unequalized frequency response)
• Gdes (desired frequency response)
Δ
�=
design (FIR equalizer) H so that G
GH ≈ Gdes
• common choice: Gdes(ω) = e−iDω (delay)
i.e., equalization is deconvolution (up to delay)
• can add constraints on H, e.g., limits on |hi| or maxω |H(ω)|
Filter design
16
Chebychev equalizer design:
�
�
��
�
minimize max �G(ω) − Gdes(ω)�
ω∈[0,π]
convex; SOCP after sampling frequency
Filter design
17
time-domain equalization: optimize impulse response g̃ of equalized
system
e.g., with Gdes(ω) = e−iDω ,
gdes(t) =
�
1 t=D
0 t �= D
sample design:
minimize
maxt�=D |g̃(t)|
subject to g̃(D) = 1
• an LP
• can use
Filter design
�
t�=D g̃(t)
2
or
�
t�=D
|g̃(t)|
18
extensions:
• can impose (convex) constraints
• can mix time- and frequency-domain specifications
• can equalize multiple systems, i.e., choose H so
G(k)H ≈ Gdes,
k = 1, . . . , K
• can equalize multi-input multi-output systems
(i.e., G and H are matrices)
• extends to multidimensional systems, e.g., image processing
Filter design
19
Equalizer design example
unequalized system G is 10th order FIR:
1
0.8
g(t)
0.6
0.4
0.2
0
−0.2
−0.4
0
1
2
3
4
5
6
7
8
9
t
Filter design
20
1
|G(ω)|
10
0
10
−1
10
0
0.5
1
1.5
2
2.5
3
2
2.5
3
ω
3
�
G(ω)
2
1
0
−1
−2
−3
0
0.5
1
1.5
ω
� (ω) ≈ e−i10ω
design 30th order FIR equalizer with G
Filter design
21
Chebychev equalizer design:
�
�
�˜
�
minimize max �G(ω) − e−i10ω �
ω
equalized system impulse response g̃
1
g̃(t)
0.8
0.6
0.4
0.2
0
−0.2
0
5
10
15
20
25
30
35
t
Filter design
22
� |
equalized frequency response magnitude |G
1
e(ω)|
|G
10
0
10
−1
10
0
0.5
1
1.5
2
2.5
3
2
2.5
3
ω
�
equalized frequency response phase � G
3
�
e(ω)
G
2
1
0
−1
−2
−3
0
0.5
1
1.5
ω
Filter design
23
time-domain equalizer design:
minimize max |g̃(t)|
t�=10
equalized system impulse response g̃
1
0.8
g̃(t)
0.6
0.4
0.2
0
−0.2
0
5
10
15
20
25
30
35
t
Filter design
24
� |
equalized frequency response magnitude |G
1
10
e(ω)|
|G
0
10
−1
10
0
0.5
1
1.5
2
2.5
3
2
2.5
3
ω
�
equalized frequency response phase � G
3
2
0
−1
−2
�
e(ω)
G
1
−3
0
0.5
1
1.5
ω
Filter design
25
Filter magnitude specifications
transfer function magnitude spec has form
L(ω) ≤ |H(ω)| ≤ U (ω),
ω ∈ [0, π]
where L, U : R → R+ are given
• lower bound is not convex in filter coefficients h
• arises in many applications, e.g., audio, spectrum shaping
• can change variables to solve via convex optimization
Filter design
26
Autocorrelation coefficients
autocorrelation coefficients associated with impulse response
h = (h0, . . . , hn−1) ∈ Rn are
rt =
�
hτ hτ +t
τ
(we take hk = 0 for k < 0 or k ≥ n)
• rt = r−t; rt = 0 for |t| ≥ n
• hence suffices to specify r = (r0, . . . , rn−1) ∈ Rn
Filter design
27
Fourier transform of autocorrelation coefficients is
R(ω) =
�
τ
n−1
�
e
−iωτ
rτ = r0 +
2rt cos ωt = |
H(ω)
|
2
t=1
• always have R(ω) ≥ 0 for all ω
• can express magnitude specification as
L(ω)2 ≤ R(ω) ≤ U (ω)2,
ω ∈ [0, π]
. . . convex in r
Filter design
28
Spectral factorization
question: when is r ∈ Rn the autocorrelation coefficients of some h ∈ Rn?
answer: (spectral factorization theorem) if and only if R(ω) ≥ 0 for all ω
• spectral factorization condition is convex in r
• many algorithms for spectral factorization, i.e., finding an h s.t.
R(ω) = |H(ω)|2
magnitude design via autocorrelation coefficients:
• use r as variable (instead of h)
• add spectral factorization condition R(ω) ≥ 0 for all ω
• optimize over r
• use spectral factorization to recover h
Filter design
29
log-Chebychev magnitude design
choose h to minimize
max |20 log10 |H(ω)| − 20 log10 D(ω)|
ω
• D is desired transfer function magnitude
(D(ω) > 0 for all ω)
• find minimax logarithmic (dB) fit
reformulate as
minimize t
subject to D(ω)2/t ≤ R(ω) ≤ tD(ω)2,
0≤ω≤π
• convex in variables r, t
• constraint includes spectral factorization condition
Filter design
30
√
example: 1/f (pink noise) filter (i.e., D(ω) = 1/ ω), n = 50,
log-Chebychev design over 0.01π ≤ ω ≤ π
1
10
0
|H(ω)|2
10
−1
10
−2
10
−1
0
10
10
ω
optimal fit: ±0.5dB
Filter design
31
MIT OpenCourseWare
http://ocw.mit.edu
6.079 / 6.975 Introduction to Convex Optimization
Fall 2009
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Download