summary dig filt

Upload: will-black

Post on 14-Apr-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 Summary Dig Filt

    1/21

    Brief Notes on Digital Filters

    Z-transforms

    For us the xn are usually samples from a signal.Remember that terms in the series must approach zero as n

    tends to . This defines the region of convergence.

    Most often we use Geometric Progression formulae to do

    the sums which can then be expressed as:

    Finite number of terms: sum =

    Infinite number of terms: sum =

    n

    nnzxzX

    ==)(

    n

    n

    oaa

    a

    aa

    N

    o

    1

    1

    1||1

    1

  • 7/29/2019 Summary Dig Filt

    2/21

    Z-transforms - Continued

    Regions of convergence in the z-planeOf the form |z| > some value(defines a region outside a circle)

    when the signal is zero for - < n < n0and then has values for n0 +1 < n < +

    Of the form |z| < some value(defines a region inside a circle)when the signal has values for - < n < n0and then is zero for n0 +1 < n < +

    Time, n sec

    Time, n sec

    Real (z)

    Imag (z)

    Real (z)

    Imag (z)

  • 7/29/2019 Summary Dig Filt

    3/21

    Inverse z-Transfroms X(z) to xn

    Definition:

    Contour of integration inside region of convergence

    Residues only at poles inside contour of integration

    SIMPLE POLE at z = zo, residue is:

    M POLES at z = zo, residue is:

    == residuesdzzXzjxn

    n )(21 1

    )()(lim1

    zXzzozzozn

    )()()!1(

    1

    lim

    1

    )1(

    )1(

    zXzzozdz

    d

    mzoz

    nm

    m

    m

  • 7/29/2019 Summary Dig Filt

    4/21

    Inverse z-Transfroms X(z) to xn

    Other methods:1.Express as known z-transforms, through partialfraction expansion.

    2.Long division______________________________________________________________________________________________In both cases, use the region of convergence to tell youwhether you want to land up with a signal decaying away tozero for:

    positive time, xn = 0 for n < nonegative time, yn = for n > no

    or both, split into two parts a positive and a

    negative time part.

  • 7/29/2019 Summary Dig Filt

    5/21

    Digital Systems (IIR Filters)

    Often H(z) is in a polynomial form:

    This is an infinite impulse response (IIR) filter.

    Difference Equation: [recall Z{xn-q } = z q X(z) ]

    hn

    H(z)Xn

    X(z)

    Yn

    Y(z)

    )()(

    .......1

    .......)(2

    2

    1

    1

    2

    2

    1

    1

    zXzY

    zazaza

    zbzbzbbzHNA

    NA

    NB

    NBo =++++++=

    NAnNAnn

    NBnNBnnnon

    yayaya

    xbxbxbxby

    +++=

    .......

    .......

    2211

    2211

  • 7/29/2019 Summary Dig Filt

    6/21

    Digital Systems (FIR Filters)Some digital systems have transfer functions [H(z)] like:

    This is a Finite Impulse Response (FIR) Filter.Difference equation is:

    Note that this 2M+1 length filter is non-causal, and yndepends on future as well as past values of xn.

    )(

    )(.......

    .......)(

    2

    2

    1

    1

    11

    11

    zX

    zYzbzbzb

    bzbzbzbzH

    M

    M

    oM

    MM

    M

    =++

    ++++=

    +

    ++

    +

    MnMnn

    nonMnMMnMn

    xbxbxb

    xbxbxbxby

    ++++

    ++++++=

    .......

    .......

    2211

    1111

  • 7/29/2019 Summary Dig Filt

    7/21

    Digital Systems (FIR Filters) continued

    Coefficients give the impulse response of these FIR filters:

    hn = bn f or Mn+M; h n= 0f or |n| > M.

    Note that the response is a convolution of xn with theimpulse response hn = bn:

    Fastest way to implement this, unless M is very small, isthrough convolution via FFTs, not forgetting to zero padappropriately.

    mmn

    Mn

    Mnmknk

    M

    Mkn xbxby

    +

    =

    = ==

  • 7/29/2019 Summary Dig Filt

    8/21

    Non Causal IIR Digital Filters

    You can have non-causal IIR filters too,(response now is a function of future values of theresponse as well as current and future values of the input)

    but they are tricky to implement.

    We split the transfer function into causal andacausal parts: H(z) = Hc(z) . Hac(z) where:

    .....1

    ......)(

    1

    1

    11

    ++

    ++=

    za

    zbbzH oc

    .....1

    ......)(

    1

    1

    11

    ++

    ++= ++

    zd

    zcczH oac

  • 7/29/2019 Summary Dig Filt

    9/21

    Non Causal IIR Digital Filters (cont)

    Hc(z) is implemented in the usual way(see difference equation on slide 5)

    The output of this part of the system becomes the inputto Hac(z)

    Hac(z) is implemented through use of the followingdifference equation:

    To implement this you start at the end of the inputseries and work back towards the start.This is equivalent to:

    NDnNAnn

    NCnNCnnnon

    ydydyd

    xcxcxcxcy

    +++

    +++

    +++=

    .......

    .......

    2211

    2211

    Time Reverse

    Signal

    Time Reverse

    Signal

    causal system:

    Hac(z1

    )

  • 7/29/2019 Summary Dig Filt

    10/21

    Frequency Response of Digital Filters

    Evaluate H(z) around the unit circle

    and f=k.fs

    /N, k=0,1,.N-1.

    This can be time-consuming. Note: you are actually doing:

    and hence this can be done efficiently in MATLAB byusing: Hfreq=fft{b,N}./fft{a,N}

    Make N very large (and a power of 2 for efficiency) to geta finely resolved spectrum.

    )2exp(2

    2

    1

    1

    2

    2

    1

    1

    .......1

    .......)(

    fjzNA

    NA

    NB

    NBo

    zazaza

    zbzbzbbzH

    =

    +++

    +++=

    }0,....0,0,,.......,,,1{

    }0....0,0,0,,....,,{)(

    121

    121

    =NNA

    NNBo

    aaaDFT

    bbbbDFTzH

  • 7/29/2019 Summary Dig Filt

    11/21

    Digital Filter Design

    All digital systems are filters but weusually we design filters to: remove noise from a signal

    differentiate or integrate a signal

    calculate the Hilbert transform of a filter

    We also sometimes design filters to simulate physical systems

    to act as controllers (not in this class)

  • 7/29/2019 Summary Dig Filt

    12/21

    FIR Filter Design (Brief Overview)

    Method 1: (Sample in time) N = 2M+1 point filter Start with H(f), the desired frequency response of ananalog filterE.g. High-pass:H(f) = 1 for |f| > fc, and H(f) = 0 for |f| < fc

    This is a severe change at |f|=fc, not really a goodidea, having a gentler transition is desirable.

    Band limit putting H(f) = 0 for |f| > fs/2. Inverse Fourier Transform (analytically) to obtain h(t). Sample and scale to obtain expressions for h(n). Window to have finite sequence M n M andevaluate to obtain coefficients:bjforj = -M ,-M+1,.-1,0,1,M.

    A window that zero smoothly at M is desirable.

  • 7/29/2019 Summary Dig Filt

    13/21

    FIR Filter Design (continued) Method 2: (Sample in frequency) N (even) point filter

    Start with H(f) the desired frequency response for0

  • 7/29/2019 Summary Dig Filt

    14/21

    FIR Filter Design (continued)

    Method 3 (Remez Exchange Algorithm)N=2M+1 point FIR filter. This is a nonlinear optimization algorithm that tries to ensure the

    frequency response error is uniform. (Doesnt always converge.) You specify a frequency and an amplitude vector that specifies

    the desired frequency response from 0 to fs/2.Example: Band-stop filter.F=[0 0.3 0.35 0.65 0.7 1.0]; A=[1 1 0 0 1 1].

    Can weight the importance of error in each band.E.g., w=[0.9 0.1 0.9]

    PASSBAND

    Normalized Frequency: 1.0 corresponds to fs/2.1.0

    1.0 PASSBANDSTOPBAND

    TransitionRegions

  • 7/29/2019 Summary Dig Filt

    15/21

    FIR Filter Design-Validation Always check out the frequency response of designed

    filter by zero-padding and FFTing filter coefficients.

    Remember the FFT program always assumes that thedata starts at t=0. You have to adjust the phaseyourself to account for time-delays or advances.

    The impulse response should tend to zero at the filterends. It not doing so indicates there are problems withthe design. You will see large ripples in the frequency

    response when this happens. Rectify by: Increasing the length of the filter Smoothing transition regions in the frequency domain Windowing the impulse response with a smoother

    window

  • 7/29/2019 Summary Dig Filt

    16/21

    Differentiators etc.

    Differentiator: H(f) = j 2

    fAmplifies high frequency noise.Digital filter will have a sharp transition at fs/2.Often a good idea to combine this with a low-passfilter also to smooth function at fs/2.

    Integrator: H(f) = 1/{j 2 f}Amplifies low frequency noise.Digital filter will have a sharp transition at 0 Hz.Often a good idea to combine this with a high-passfilter also to smooth function at 0.

    Hilbert Transformer H(f) = -j sign(f).Digital filter has sharp transition regions at f=0 & fs/2.

    Good idea to smooth function in these regions.

  • 7/29/2019 Summary Dig Filt

    17/21

    IIR Filter Design

    Analog Design mapped into Digital Design Impulse invariant mappingH(s) h(t) h(n) H(z)

    aliasing an issue, therefore not a good idea for design of,e.g., high-pass filters.

    Stable in s-plane (poles in LHP) stable in z-plane (poles inside unit circle)

    Bilinear mappingUse H(s) and substitute

    Frequency distortion, must pre-warp to account for this inthe design.

    Stability conserved, entire left half plane maps into unitcircle.

    )z/()z).(/(s11

    112

    +=

    )/(tan)./( .digitallogana 22 =

  • 7/29/2019 Summary Dig Filt

    18/21

    IIR Filter Design (continued)

    We only looked at a Butterworth low-pass filterH(s).H(-s) = 1/[ 1 + (s/jc)2N ]

    Poles equispaced around a circle in the s-plane.Radial positions of poles: |Sk| = cAngular positions of H(s) poles:Sk = 90 + [ (1+2k).180/2N ] degrees, k=1,2,..N.

    Left Half Plane poles correspond to H(s),Right Half Plane poles correspond to H(-s).

    E.g., N=3, H(s) = [ (1-s/s1) (1-s/s2) (1-s/s3) ]

  • 7/29/2019 Summary Dig Filt

    19/21

    IIR Filter Design (continued)

    Finding N and c1. Specify desired digital characteristicsat digital-1 20 log10 |Hdigital| = -K1 dB

    at digital-2

    20 log10

    |Hdigital

    | = -K2 dB

    2. Transform digital design to analog (pre-warp)

    analog-1 = (2/) tan (digital-1/2)

    analog-2 = (2/) tan (digital-2/2)

    at analog-1 10 log10 |Hanalog|2 = -K1 dB (**)

    at analog-2 10 log10 |Hanalog|2 = -K2 dB (***)

  • 7/29/2019 Summary Dig Filt

    20/21

    IIR Filter Design (continued)

    Use (**) and (***) to solve for N and cRound up N to make it integer.

    Write down locations of poles in LHP of Butterworth

    filter with this N and

    c

    .

    S1,s2,s3 etc.

    Form H(s)

    E.g., N=3, H(s) = 1/[ (1-s/s1) (1-s/s2) (1-s/s3) ] Apply bilinear transform

    to determine H(z).

    Check out the resulting frequency response of H(z).

    )z/()z).(/(s11

    112

    +=

  • 7/29/2019 Summary Dig Filt

    21/21

    IIR High-pass, Notch and Band-pass Filters

    You can transform a low-pass Butterworth filter into a

    high-pass filter by replacing (s/jc) with (jc/s) in theoriginal design.

    You can combine a low- and high-pass in series to

    produce a band-pass filter.H = HLP . HHP

    You can combine a low- and high-pass in parallel toproduce a band-stop (notch) filter.

    H = HLP + HHP

    Or, you can use mappings to create analog Butterworth band-passand band-stop filters in the first stage of the design. (Similar tothe high-pass mapping in the first bullet, but more complicated.)See Oppenheim and Schafer or most any other Digital Filteringbook.