5,6. dsp theory - uni-saarland.de · 5,6. dsp theory system analysis, filters, ... point dft n+m-1...

46
5,6. DSP Theory System Analysis, Filters, IIR, FIR Rahil Mahdian 24.03.2016

Upload: buicong

Post on 21-Aug-2018

226 views

Category:

Documents


0 download

TRANSCRIPT

  • 5,6. DSP Theory

    System Analysis, Filters, IIR, FIR

    Rahil Mahdian 24.03.2016

  • 2

    continuous DiscreteP

    erio

    dic

    aPer

    iodi

    c

    FS

    CTFT

    DTFTZ

    DFSDFT

    FFT

    Signal Transforms - review

  • 3

    Convolution in DFT

    DFT

    In DFT convolutionproperty holds, but incyclic convolution sense.

    Q. How to get Linearconvolution result ofLTI systems, usingCircular convolution?

  • 4

    (length N)

    (length M)

    Zeropadding(M-1) 0s

    Zeropadding(N-1) 0s

    N+M-1point DFT

    N+M-1point DFT

    N+M-1point IDFT

    Linear Convolution from Circularprocessing in DFT world

  • 5

    Upsampling - interpolation

    xi[n] in a low-pass filtered version of x[n]

    The low-pass filter impulse response is

    Hence the interpolated signal is written as

    L/n

    L/nsinnhi

    ki

    L/kLn

    L/kLnsinkxnx

    To create an upsampled signal, from the zeropaddedexpanded version, pass it through a LPF. (Gain something!)

  • 6

    Useful Noble Identities

    M H(Z)

    H(ZM) M

    X[n]

    X[n]

    Xa[n]

    Xb[n]

    ya[n]

    yb[n]

    H(Z) LX[n] Xa[n] ya[n]

    X[n] Xb[n] yb[n]L H(ZL)

  • 7

    Question

    Problem. Explore the condition by which the changing the sequence ofupsampler and downsampler blocks, does not make a difference on the outputof the system?

    M MN NX(n) X(n)y(n) y(n)

    ?

  • 8

    Polyphase filtering

    =

    Goal: Less number of multiplications per time unit Simpler structure of implementing a filter Used in filterbank

  • 9

    Polyphase sequence decomposition

  • 10

    Polyphase components

  • 11

    PolyPhase Decimation System

  • 12

    PolyPhase Interpolation System

  • 13

    Ideal Filters

  • 14

    FIR filter - basics

    No phase shift No distortion

    Ideal delay filter

    Linear phase shift is still good. (desirable)

  • 15

    Design of a Digital Filter

    DigitalFilters:

    IIR

    FIR

    Design ananalogequivalent

    Convert it toDigital

    Direct designusing computer

    e.g., Butterworth, Chebyshev, etc.

    Windowing approach

    Frequency samplingapproach

    Computer-basedoptimization methods

    Filter Design Approaches

  • 16

    Filter attributes

    FIRInherently BIBO stableEasy to implementCan be designed to have linear phase property

    IIRSometimes unstableLower filter order than a corresponding FIR filterUsually have nonlinear phase property

  • 17

    M

    k

    kk

    N

    k

    kk

    MM

    NN

    za

    zb

    zaza

    zbzbbzH

    1

    0

    11

    110

    1

    1

    zXzY

    pzpzpz

    zzzzzzkzH

    N

    N

    21

    21

    M

    kk

    N

    kk

    k

    knyaknxb

    knxkhny

    10

    0

    IIR filter System Transfer function

  • 18

    Ideal Filters

  • 19

    Realistic vs. Ideal Filter Response

  • 20

    Impulse Invariance method

    Design a continous time filter and take samples from it, using the followingprocedure:

    (t) sampling

    h[n]=

    = )

    +

    2

    )

    =

    , ||

  • 21

    The system function and are related by)( sH a)( zH

    k

    aezk

    TjsH

    TzH sT )

    2(

    1)(

    ]Re[z

    ]Im[zjj

    0

    s-plane

  • 22

    Butterworth Lowpass Filters

    Passband is designed to be maximally flat

    The magnitude-squared function is of the form

    N2c

    2

    cj/j1

    1jH

    N2c

    2

    cj/s1

    1sH

    1-0,1,...,2Nkforej1s 1Nk2N2/jccN2/1

    k

  • 23

    Chebyshev Filters

    Equiripple in the passband and monotonic in the stopband

    Or equiripple in the stopband and monotonic in the passband

    xcosNcosxV/V1

    1jH 1N

    c2N

    2

    2

    c

  • 24

    Impulse invariance applied to Butterworth

    Since sampling rate Td cancels out we can assume Td=1

    Map spec to continuous time

    Butterworth filter is monotonic so spec will be satisfied if

    Determine N and c to satisfy these conditions

    3.00.17783eH

    2.001eH89125.0

    j

    j

    3.00.17783jH

    2.001jH89125.0

    0.177833.0jHand89125.02.0jH cc

    N2c

    2

    cj/j1

    1jH

    Example

  • 25

    Satisfy both constrains

    Solve these equations to get

    N must be an integer so we round it up to meet the spec

    Poles of transfer function

    The transfer function

    Mapping to z-domain

    2N2

    c

    2N2

    c 17783.0

    13.01and

    89125.0

    12.01

    70474.0and68858.5N c

    0,1,...,11kforej1s 11k212/jcc12/1

    k

    21

    1

    21

    1

    21

    1

    z257.0z9972.01

    z6303.08557.1

    z3699.0z0691.11

    z1455.11428.2

    z6949.0z2971.11

    z4466.02871.0zH

    4945.0s3585.1s4945.0s9945.0s4945.0s364.0s12093.0

    sH222

    Example Contd

  • 26

    -1 -0.5 0 0.5 1-20

    -15

    -10

    -5

    0

    5

    10

    15

    20

    , x

    =

    tan

    (/2

    )

    Frequency Warping

    )(

    )(

    cos

    sin

    2tan

    2/2/21

    2/2/21

    2

    2

    jj

    jjj

    ee

    ee

    .1

    1

    .1

    11

    j

    j

    j

    j

    e

    ej

    e

    e

    j

    Since s=jW and z=ejw, wehave

    .1

    11

    1

    z

    zs

    Bilinear Transform

  • 27

    Example

    Bilinear transform applied to Butterworth

    Apply bilinear transformation to specifications

    We can assume Td=1 and apply the specifications to

    To get

    3.00.17783eH

    2.001eH89125.0

    j

    j

    2

    3.0tan

    T

    20.17783jH

    2

    2.0tan

    T

    201jH89125.0

    d

    d

    N2c

    2

    c/1

    1jH

    2N2

    c

    2N2

    c 17783.0

    115.0tan21and

    89125.0

    11.0tan21

  • 28

    Example Contd

    Solve N and c

    The resulting transfer function has the following poles

    Resulting in

    Applying the bilinear transform yields

    6305.5

    1.0tan15.0tanlog2

    189125.0

    11

    17783.0

    1log

    N

    22

    766.0c

    0,1,...,11kforej1s 11k212/jcc12/1

    k

    5871.0s4802.1s5871.0s0836.1s5871.0s3996.0s20238.0

    sH222c

    21

    2121

    61

    z2155.0z9044.01

    1

    z3583.0z0106.11z7051.0z2686.11

    z10007378.0zH

  • 29

    FIR - constraints

    Filter to have a limited number of the taps(components)

    To have a linear phase shift Causal, stable and implementable As close as possible to the ideal desired filter

    = k1+k2

    N

    n

    nznhzH0

    ][)(

    ][][ nNhnh

  • 30

    FIR filter - basics

    No phase shift No distortion

    Ideal delay filter

    Linear phase shift is still good. (desirable)

  • 31

    FIR filters

  • 32

    The frequency response of FIR filters

    )()(

    1

    0

    )()(

    )()(

    jjj

    M

    n

    njj

    eHeeH

    enheH

    )( jeH Magnitude response function

    Amplitude response function)(H

    jjjn

    njj

    eee

    enheH

    )cos21(1

    )()(

    2

    2

    0

    3/2

    3/20)(

    0,cos21)( jeH

    0

    )(

    cos21)(H

    Example

  • 33

    FIR types (linear phase)

  • 34

    For Linear Phase t.f. (order N-1)

    so that for N even:)1()( nNhnh

    1

    2

    12

    0).().()(

    N

    Nn

    nN

    n

    n znhznhzH

    1

    2

    0

    )1(1

    2

    0).1().(

    N

    n

    nNN

    n

    n znNhznh

    1

    2

    0)(

    N

    n

    mn zznh nNm 1 for N odd:

    12

    1

    0

    2

    1

    2

    1).()(

    N

    n

    N

    mn zN

    hzznhzH

    FIR types cont.

  • 35

    Type-1 Type-2 Type-3 Type-4

    N=2Lo=even N=2Lo+1=odd N=2Lo=even N=2Lo+1=odd

    symmetric symmetric anti-symmetric anti-symmetric

    h[k]=h[N-k] h[k]=h[N-k] h[k]=-h[N-k] h[k]=-h[N-k]

    FIR types (linear phase)

  • 36

    Rectangular

    Bartlett

    Hann

    Hamming

    Blackman

    Kaiser

    2

    1

    NnN

    n21

    N

    n2cos1

    N

    n2cos46.054.0

    N

    n

    N

    n 4cos08.0

    2cos5.042.0

    )(1

    21 0

    2

    0 JN

    nJ

    Commonly used windows

  • 37

    Transition width (Hz)

    Min. stopattn dB

    2.12 1.5/N 30

    4.54 2.9/N 50

    6.76 4.3/N 70

    8.96 5.7/N 90

    Kaiser window

  • 38

    Windowname

    Window function Filter

    Peak valueof side lobe

    The width ofmain lobe

    Transitionwidth

    Min.stopband

    attenuation

    Rectangular -13 dB -21 dB

    Bartlett -25 dB -25 dB

    Hanning -31 dB -44 dB

    Hamming -41 dB -53 dB

    Blackman -57 dB -74 dB

    N4

    N8

    N8

    N8

    N12

    N8.1

    N2.4

    N2.6

    N6.6

    N11

  • 39

    0 10 20 300

    0.2

    0.4

    0.6

    0.8

    1

    Triangular window: N=35

    n-1 -0.5 0 0.5 1

    -60

    -40

    -20

    0

    Magnitude response

    frequency in pi units

    dB

    -1 -0.5 0 0.5 1

    0

    5

    10

    15

    20Amplitude response

    frequency in pi units-1 -0.5 0 0.5 1

    -40

    -30

    -20

    -10

    0

    Magnitude response of filter: wc=0.5pi

    frequency in pi units

    dB

  • 40

    0 10 20 300

    0.2

    0.4

    0.6

    0.8

    1

    Hanning window: N=35

    n-1 -0.5 0 0.5 1

    -60

    -40

    -20

    0

    Magnitude response

    frequency in pi units

    dB

    -1 -0.5 0 0.5 1

    0

    5

    10

    15

    Amplitude response

    frequency in pi units-1 -0.5 0 0.5 1

    -60

    -40

    -20

    0

    Magnitude response of filter: wc=0.5pi

    frequency in pi units

    dB

  • 41

    0 10 20 300

    0.2

    0.4

    0.6

    0.8

    1

    Hamming window: N=35

    n-1 -0.5 0 0.5 1

    -60

    -40

    -20

    0

    Magnitude response

    frequency in pi units

    dB

    -1 -0.5 0 0.5 1

    0

    5

    10

    15

    20Amplitude response

    frequency in pi units-1 -0.5 0 0.5 1

    -60

    -40

    -20

    0

    Magnitude response of filter: wc=0.5pi

    frequency in pi units

    dB

  • 42

    0 10 20 300

    0.2

    0.4

    0.6

    0.8

    1

    Blackman window: N=35

    n-1 -0.5 0 0.5 1

    -80

    -60

    -40

    -20

    0

    Magnitude response

    frequency in pi units

    dB

    -1 -0.5 0 0.5 1

    0

    5

    10

    15

    Amplitude response

    frequency in pi units-1 -0.5 0 0.5 1

    -80

    -60

    -40

    -20

    0

    Magnitude response of filter: wc=0.5pi

    frequency in pi units

    dB

  • 43

    -10 0 100

    0.2

    0.4

    0.6

    0.8

    1

    Kaiser window: N=35,beta=7.865

    n-1 -0.5 0 0.5 1

    -100

    -80

    -60

    -40

    -20

    0

    Magnitude response

    frequency in pi units

    dB

    -1 -0.5 0 0.5 1

    0

    5

    10

    15

    20Amplitude response

    frequency in pi units-1 -0.5 0 0.5 1

    -100

    -80

    -60

    -40

    -20

    0

    Magnitude response of filter: wc=0.5pi

    frequency in pi units

    dB

  • 44

    -10 0 100

    0.2

    0.4

    0.6

    0.8

    1

    Kaiser window: N=35,beta=9.5

    n-1 -0.5 0 0.5 1

    -100

    -80

    -60

    -40

    -20

    0

    Magnitude response

    frequency in pi units

    dB

    -1 -0.5 0 0.5 1

    0

    5

    10

    15

    20Amplitude response

    frequency in pi units-1 -0.5 0 0.5 1

    -100

    -80

    -60

    -40

    -20

    0

    Magnitude response of filter: wc=0.5pi

    frequency in pi units

    dB

  • 45

    0 5 10 15 20 25 30

    0

    0.1

    0.2

    0.3

    Ideal Impulse Response

    n 0 5 10 15 20 25 300

    0.2

    0.4

    0.6

    0.8

    1

    Hamming Window

    n

    0 5 10 15 20 25 30

    0

    0.1

    0.2

    0.3

    Actual Impulse Response

    n 0 0.2 0.4 0.6 0.8 1-100

    -80

    -60

    -40

    -20

    0Magnitude Response in dB

    pi

    dB

    34N

  • 46

    Filter toolbox - MATLAB

    Y = resample(X,P,Q) resamples the sequence in vector X atP/Q times the original sample rate using a polyphaseimplementation.

    fdatool