ece 4680 dsp laboratory 5: iir digital · pdf fileece 4680 dsp laboratory 5: iir digital...

Download ECE 4680 DSP Laboratory 5: IIR Digital · PDF fileECE 4680 DSP Laboratory 5: IIR Digital Filters Introduction and Background 2 Direct Form I An IIR filter has feedback, thus from DSP

If you can't read please download the document

Upload: ngonga

Post on 06-Feb-2018

231 views

Category:

Documents


2 download

TRANSCRIPT

  • ECE 4680 DSP Laboratory 5:IIR Digital Filters

    Due 12:15 PM Friday, November 21, 2014

    Introduction and Background

    Infinite Impulse Response BasicsChapter 4 of the course text deals with infinite impulse response (IIR) digital filters. IIR filtersoften result from a desire to represent a traditional analog filter (Butterworth, Chebyshev, or ellip-tical) in discrete-time form. As a simple motivational example, consider the RC lowpass filtershown in Figure 1. We may choose to implement this in the discrete-time domain using either the

    impulse invariant approach or via a bilinear transformation. For details on these two approachesconsult a DSP text, such as Oppenheim & Schafer1. In general we desire approaches to convertany into . Let us first recall the general form of a discrete-time IIR system and con-sider filter topologies that will lead to efficient real-time implementation.

    General IIR FormWhen a general IIR filter is obtained from say MATLABs fdatool, the result is a coefficient setthat starts out in direct form, that is we have

    (1)

    where N is the filter order. The corresponding difference equation which must be implemented inreal-time, for a direct-form based filter topology, is

    (2)

    1. A. Oppenheim and R. Schafer, Discrete-Time Signal Processing, 3rd edition, Prentice Hall, New Jersey, 2010, Chapter 7.

    Input OutputR

    CHc s( )

    11 sRC+--------------------=

    hc t( )1RC--------e

    t RC( ) u t( )=

    Figure 1: RC lowpass filter.

    Hc s( ) H z( )

    H z( )b0 b1z

    1 bMzM

    + + +

    1 a1z1 aNz

    N+ + +

    -----------------------------------------------------------=

    y n[ ] aky n k[ ]k 1=

    N

    bkx n k[ ]k 0=

    M

    +=

    Introduction and Background 1

  • ECE 4680 DSP Laboratory 5: IIR Digital Filters

    Direct Form IAn IIR filter has feedback, thus from DSP theory we recall the general form of an N-order IIR fil-ter is

    . (3)

    By z-transforming both sides of (3) and using the fact that , we can write

    (4)

    IIR filters can be implemented in a variety of topologies, the most common ones, direct form I, II,cascade, and parallel, will be reviewed below.

    Direct Form IDirect implementation of (3) leads to the following structure of Figure 2. The calculation of

    for each new requires the ordered solution of two difference equations

    (5)

    y n[ ] aky n k[ ]k 1=

    N

    brx n r[ ]r 0=

    M

    +=

    H z( ) Y z( ) X z( )=

    H z( )b0 b1z

    1 bMzM

    + + +

    1 a1z1 a2z

    2 aNzN

    + + + +---------------------------------------------------------------------------=

    y nx nb0

    b1

    b2

    b3

    bM

    a1

    a2

    a3

    aN

    z 1

    z 1

    z 1

    z 1z 1

    z 1

    z 1

    z 1

    ...... ......

    Direct Form I Structure

    Coeff Space= N+M+1

    Buffer Space= N+M

    Additions= N+M

    v n

    Multiplications= N+M+1

    Figure 2: Direct form I structure for IIR filter implementation.

    y n[ ]

    x n[ ]

    v n[ ] bkx n k[ ]k 0=

    M

    =

    y n[ ] v n[ ] aky n k[ ]k 1=

    N

    =

    Introduction and Background 2

  • ECE 4680 DSP Laboratory 5: IIR Digital Filters

    Direct Form IIA more efficient direct form structure can be realized by placing the feedback section first, fol-lowed by the feedforward section. The first step in this rearrangement is that of Figure 3.

    The final direct form II structure is shown below in Figure 4.

    The ordered pair of difference equations needed to obtain from is

    (6)

    &

    (

    )

    (%

    )%

    %

    %

    (%

    (%

    (%

    (%

    (%

    (%

    (%

    (%

    Figure 3: Rearrange the direct form I structure to place the feedbackterms first.

    .........

    !

    ""!

    #!$

    Figure 4: Direct form II structure.

    y n[ ] x n[ ]

    w n[ ] x n[ ] akw n k[ ]k 1=

    N

    =

    y n[ ] bkw n k[ ]k 0=

    M

    =

    Introduction and Background 3

  • ECE 4680 DSP Laboratory 5: IIR Digital Filters

    Cascade FormSince the system function, , is a ratio of polynomials, it is possible to factor the numeratorand denominator polynomials in a variety of ways. The most popular factoring scheme is as aproduct of second-order polynomials, which at the very least insures that conjugate pole and zerospairs can be realized with real coefficients

    , (7)

    where is the largest integer in . A product of system functions cor-responds to a cascade of biquad system blocks is shown in Figure 5. The kth biquad can be imple-

    mented using a direct form structure (typically direct form II), as shown in Figure 6. The

    corresponding biquad difference equations are

    (8)

    . (9)

    The cascade of biquads is very popular in real-time DSP, is supported by the MATLAB signalprocessing toolbox, and will be utilized in example code presented later.

    Filter s-Domain to z-Domain Transformation

    Impulse Invariant MethodA simple and natural way to obtain a discrete-time implementation of an analog filter is to samplethe impulse response , i.e., let

    H z( )

    H z( )b0k b1kz

    1 b2kz2

    + +

    1 a1kz1 a2kz

    2+ +

    ---------------------------------------------------

    k 1=

    Ns

    Hk z( )k 1=

    Ns

    = =

    Ns N 1+( ) 2= N 1+( ) 2

    Figure 5: Cascade of biquadratic sections to implement a IIR filter.N 2>

    Figure 6: Detailed view of the direct form II biquadratic section.

    wk n[ ] yk 1 n[ ] a1kwk n 1[ ] a2kwk n 2[ ]=

    yk n[ ] b0kwk n[ ] b1kwk n 1[ ] b2kwk n 2[ ]+ +=

    hc t( )

    Filter s-Domain to z-Domain Transformation 4

  • ECE 4680 DSP Laboratory 5: IIR Digital Filters

    . (10)

    In the frequency domain the analog frequency response, , becomesthe discrete-time frequency response, , via the ideal sampling theory result

    . (11)

    From Figure 7 we see that if is not bandlimited, aliasing shows up in

    Applying this to the RC lowpass filer example introduced earlier, we have

    (12)

    In difference equation form we now have

    (13)

    and the pole-zero plot of Figure 8.

    h n[ ] hc nT( )=

    Ha j( ) Ha ( ) Hc j( )= =H ej( )

    H ej( ) HaT----

    2kT---------+

    k =

    =

    Ha ( ) H ej( )

    Figure 7: Frequency response of an impulse invariant filter is likely tohave some aliasing when compared to the analog prototype.

    h n[ ] Thc nT( )=

    TRC--------e

    nT RC( ) u n[ ]=

    TRC-------- e

    T RC( )( )nu n[ ]=

    y n[ ] eTRC-------- y n 1[ ]= TRC--------x n[ ]+

    z-Plane

    eTRC--------Figure 8: Pole-zero plot of RC low-

    pass filter following impulse invari-ant transformation.

    Filter s-Domain to z-Domain Transformation 5

  • ECE 4680 DSP Laboratory 5: IIR Digital Filters

    In the z-domain the filter takes the form

    . (14)

    Bilinear Transformation MethodA drawback of the impulse invariant approach is that aliasing of the analog filters frequencyresponse can occur unless certain filter roll-off conditions are met. Basically, any portion of theanalog filter frequency response that extends above the folding frequency, , folds into theprinciple alias band that runs over . The bilinear transform approach avoids through afrequency warping transformation which makes the analog frequency axis is firstmapped to the frequency interval , before being converted to the discrete-timedomain.

    It turns out that the impulse invariant technique used the many-to-one mapping

    . (15)

    To correct the aliasing problem we first employ a one-to-one mapping,

    , (16)

    which compresses the entire s-plane into a strip as shown in Figure 9.

    Following the compression mapping we convert to the z-plane as before, except this time there isnothing that can alias. The complete mapping from s to z is

    (17)

    or in reverse

    (18)

    The frequency axis mapping is of the form

    H z( ) T RC( )1 e T RC( ) z 1------------------------------------- ROC: z e T RC( )>,=

    fs 20 fs 2,[ ]

    0 f

  • ECE 4680 DSP Laboratory 5: IIR Digital Filters

    (19)

    or

    (20)

    The basic filter design equation is

    (21)

    In a practical design in order to preserve desired discrete-time critical frequencies, such as thepassband and stopband cutoff frequencies, we use frequency prewarping

    (22)

    where is a discrete-time critical frequency that must be used in the design of an analog proto-type with corresponding continuous-time critical frequency . The frequency axis compressionimposed by the bilinear transformation can make the transition ratio in the discrete-time domainsmaller than in the continuous-time domain, thus resulting in a lower order analog prototype thanif the design was implemented purely as an analog filter. Given a ratio of polynomials in the s-domain, or an amplitude response specification, we can proceed to find . The resulting trans-formation is know as the bilinear transform and takes the form

    . (23)

    For a given s-domain filter prototype, , the transformation produces z-domain system func-tion of the form

    . (24)

    In the case of the RC lowpass filter example, we have

    (25)

    The difference equation is

    2T---2----

    tan=

    2tan 1 T 2( )=

    H z( ) Ha s( )s 2T---

    1 z 11 z 1+---------------- =

    =

    i2T---

    i2-----

    tan=

    ii

    H z( )

    s 2T---1 z 11 z 1+----------------=

    Hc s( )

    H z( ) Hc2T---

    1 z 11 z 1+----------------

    =

    H z( ) 1

    1 2RCT-----------1 z 11 z 1+----------------

    +

    -----------------------------------------