Filter design - Stanford University · PDF fileFilter design • FIR filters •...

of 31/31
Filter design FIR filters Chebychev design linear phase filter design equalizer design filter magnitude specifications 1
  • date post

    23-Mar-2018
  • Category

    Documents

  • view

    230
  • download

    2

Embed Size (px)

Transcript of Filter design - Stanford University · PDF fileFilter design • FIR filters •...

  • 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) =

    n1

    =0

    hu(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 + h1ei + + hn1ei(n1)

    =n1

    t=0

    ht cos t + in1

    t=0

    ht sin t

    (EE tradition uses j =1 instead of i)

    H is periodic and conjugate symmetric, so only need to know/specifyfor 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 4 6 8 10 12 14 16 18 20

    0.2

    0.1

    0

    0.1

    0.2

    t

    h(t

    )

    Filter design 4

  • frequency response magnitude (i.e., |H()|):

    0 0.5 1 1.5 2 2.5 310

    3

    102

    101

    100

    101

    |H(

    )|

    frequency response phase (i.e., 6 H()):

    0 0.5 1 1.5 2 2.5 33

    2

    1

    0

    1

    2

    3

    6H

    ()

    Filter design 5

  • Chebychev design

    minimize max[0,]

    |H() Hdes()|

    h is optimization variable Hdes : R C is (given) desired transfer function convex problem can add constraints, e.g., |hi| 1sample (discretize) frequency:

    minimize maxk=1,...,m

    |H(k) Hdes(k)|

    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:

    minimize tsubject to

    A(k)h b(k) t, k = 1, . . . ,m

    where

    A(k) =

    [1 cosk cos(n1)k0 sink sin(n1)k

    ]

    b(k) =

    [Hdes(k)Hdes(k)

    ]

    h =

    h0...

    hn1

    Filter design 7

  • Linear phase filters

    suppose

    n = 2N + 1 is odd impulse response is symmetric about midpoint:

    ht = hn1t, t = 0, . . . , n 1

    then

    H() = h0 + h1ei + + hn1ei(n1)

    = eiN (2h0 cosN + 2h1 cos(N1) + + hN)= eiNH()

    Filter design 8

  • term eiN represents N -sample delay

    H() is real

    |H()| = |H()|

    called linear phase filter ( 6 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, s

    Filter design 11

  • Linear phase lowpass filter design

    sample frequency can assume wlog H(0) > 0, so ripple spec is

    1/1 H(k) 1

    design for maximum stopband attenuation:

    minimize 2subject to 1/1 H(k) 1, 0 k p

    2 H(k) 2, s k

    Filter design 12

  • passband ripple 1 is given

    an LP in variables h, 2

    known (and used) since 1960s

    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 4 6 8 10 12 14 16 18 20

    0.2

    0.1

    0

    0.1

    0.2

    t

    h(t

    )

    Filter design 14

  • frequency response magnitude (i.e., |H()|):

    0 0.5 1 1.5 2 2.5 310

    3

    102

    101

    100

    101

    |H(

    )|

    frequency response phase (i.e., 6 H()):

    0 0.5 1 1.5 2 2.5 33

    2

    1

    0

    1

    2

    3

    6H

    ()

    Filter design 15

  • Equalizer design

    G()H()

    equalization: given

    G (unequalized frequency response)

    Gdes (desired frequency response)

    design (FIR equalizer) H so that G= GH Gdes

    common choice: Gdes() = eiD (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[0,]

    G() Gdes()

    convex; SOCP after sampling frequency

    Filter design 17

  • time-domain equalization: optimize impulse response g of equalizedsysteme.g., with Gdes() = e

    iD,

    gdes(t) =

    {1 t = D0 t 6= D

    sample design:minimize maxt6=D |g(t)|subject to g(D) = 1

    an LP can use t6=D g(t)2 or

    t6=D |g(t)|

    Filter design 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:

    0 1 2 3 4 5 6 7 8 90.4

    0.2

    0

    0.2

    0.4

    0.6

    0.8

    1

    t

    g(t

    )

    Filter design 20

  • 0 0.5 1 1.5 2 2.5 310

    1

    100

    101

    |G(

    )|

    0 0.5 1 1.5 2 2.5 33

    2

    1

    0

    1

    2

    3

    6G

    ()

    design 30th order FIR equalizer with G() ei10

    Filter design 21

  • Chebychev equalizer design:

    minimize max

    G() ei10

    equalized system impulse response g

    0 5 10 15 20 25 30 350.2

    0

    0.2

    0.4

    0.6

    0.8

    1

    t

    g(t

    )

    Filter design 22

  • equalized frequency response magnitude |G|

    0 0.5 1 1.5 2 2.5 310

    1

    100

    101

    |e G(

    )|

    equalized frequency response phase 6 G

    0 0.5 1 1.5 2 2.5 33

    2

    1

    0

    1

    2

    3

    6e G(

    )

    Filter design 23

  • time-domain equalizer design:

    minimize maxt6=10

    |g(t)|

    equalized system impulse response g

    0 5 10 15 20 25 30 350.2

    0

    0.2

    0.4

    0.6

    0.8

    1

    t

    g(t

    )

    Filter design 24

  • equalized frequency response magnitude |G|

    0 0.5 1 1.5 2 2.5 310

    1

    100

    101

    |e G(

    )|

    equalized frequency response phase 6 G

    0 0.5 1 1.5 2 2.5 33

    2

    1

    0

    1

    2

    3

    6e G(

    )

    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 responseh = (h0, . . . , hn1) Rn are

    rt =

    hh+t

    (we take hk = 0 for k < 0 or k n)

    rt = rt; rt = 0 for |t| n hence suffices to specify r = (r0, . . . , rn1) Rn

    Filter design 27

  • Fourier transform of autocorrelation coefficients is

    R() =

    eir = r0 +n1

    t=1

    2rt cost = |H()|2

    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) fitreformulate as

    minimize tsubject 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

    101

    100

    102

    101

    100

    101

    |H(

    )|2

    optimal fit: 0.5dB

    Filter design 31