29
Colorado State University Dept of Electrical and Computer Engineering ECE423 – 1 / 29 Lecture 8 - IIR Filters (II) James Barnes ([email protected]) Spring 2014

Lecture 8 - IIR Filters (II)...IIR Filter Design Overview Method: Impulse Invariance for IIR FIlters Approximation of Derivatives Bilinear Transform Matched Z-Transform Colorado State

  • Upload
    others

  • View
    37

  • Download
    0

Embed Size (px)

Citation preview

  • Colorado State University Dept of Electrical and Computer Engineering ECE423 – 1 / 29

    Lecture 8 - IIR Filters (II)

    James Barnes ([email protected])

    Spring 2014

  • Lecture 8 Outline

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 2 / 29

    ● Introduction● Digital Filter Design by Analog → Digital Conversion● (Probably next lecture) ”All Digital” Design Algorithms● (Next lecture) Conversion of Filter Types by Frequency Transformation

  • Introduction

    ❖ Lecture 8 Outline

    Introduction❖ IIR Filter DesignOverview

    Method: ImpulseInvariance for IIR FIlters

    Approximation ofDerivatives

    Bilinear Transform

    Matched Z-Transform

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 3 / 29

  • IIR Filter Design Overview

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 4 / 29

    ● Methods which start from analog design

    ✦ Impulse Invariance✦ Approximation of Derivatives✦ Bilinear Transform✦ Matched Z-transform

    All are different methods of mapping the s-plane onto the z-plane● Methods which are ”all digital”

    ✦ Least-squares✦ McClellan-Parks

  • Method: Impulse Invariance for IIR FIlters

    ❖ Lecture 8 Outline

    Introduction

    Method: ImpulseInvariance for IIR FIlters

    ❖ Impulse Invariance

    ❖ Impulse Invariance (2)

    ❖ Impulse Invariance (3)

    ❖ Impulse Invariance (4)

    ❖ Impulse InvarianceProcedure❖ Impulse InvarianceExample

    ❖ Impulse InvarianceExample (2)

    Approximation ofDerivatives

    Bilinear Transform

    Matched Z-Transform

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 5 / 29

  • Impulse Invariance

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 6 / 29

    We start by sampling the impulse response of the analog filter:

    ha(t) h[n] = h

    a(nt0)

    t0

    Sampling Theorem gives relation between Fourier Transform of sampled andcontinuous ”signals”:

    H(z)|z=ejω =1

    t0

    ∞∑k=−∞

    Ha(jω

    t0− j

    2πk

    t0), (1)

    where ω = Ωt0 = 2πf/fs and f is the analog frequency in Hz.

  • Impulse Invariance (2)

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 7 / 29

    Analytic Continuation: assume eqn (1) holds true over the entire complex s and zplanes. Equvalent to replacing Ω with s

    jand ω with st0

    j. Sampling the impulse

    response is equivalent to mapping the s-plane to the z-plane using

    z = est0 = eσt0ejΩt0 (2)

    From the polar representation of z = r ejω:

    ● The entire Ω axis of the s-plane wraps around the unit circle of the z-plane aninfinite number of times;

    ● The negative half s-plane maps to the interior of the unit circle and the RHPto the exterior. This means stable analog filters (poles in LHP) will transformto stable digital filters (poles inside unit circle).

    ● This is a many-to-one mapping of strips of the s-plane to regions of thez-plane.

    ✦ Not a conformal mapping.✦ The poles map according to z = est0 , but the zeros do not

  • Impulse Invariance (3)

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 8 / 29

    Mapping

    ���������������������������������������������

    ������������������������������������������������������������������������������������������

    ���������������������������������������������

    jΩ

    σ

    . . .

    . . .

    πt0

    s-plane

    3 πt0

    - πt0 ��������

    ����������������������������������������������������������������

    ������������������������������������������������������������������������

    ����������������

    ����������������

    ����������������������������1+j0

    z-plane

  • Impulse Invariance (4)

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 9 / 29

    Limitation of Impulse Invariance: overlap of images of the frequency response.This prevents it from being used for high-pass filter design

    �����

    �����

    �����

    �����

    ω

    H(ejω)

    -2π

    Ωct0

    Ωc

    Ha(jΩ)

    1t0

    1

    Advantage of Impulse Invariance: linear translation between Ω and ω - preservesshape of filter frequency response.

  • Impulse Invariance Procedure

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 10 / 29

    How do we use Impulse Invariance for IIR filter design? Start with Partial FractionExpansion of Analog Filter, where αkare the pole locations. NOTE: IN THIS ANDMOST OF THE FOLLOWING, IT IS ASSUMED THAT ALL POLES AREFIRST-ORDER (NOT MULTIPLE).

    Ha(s) =

    N∑k=1

    Aks− αk

    ⇒ ha(t) =

    N∑k=1

    Akeαktu(t) (3)

    and the sampled impulse response is

    h[n] = ha(nt0) =N∑

    k=1

    Akeαknt0u[n] (4)

    with discrete-time transfer function

    H(z) =N∑

    k=1

    Ak1− eαkt0z−1

    (5)

  • Impulse Invariance Example

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 11 / 29

    Let Ha = s+a(s+a)2+b2 . This filter has a zero at β=-a and poles at αk = −a± jb. Thepartial fraction expansion is

    Ha(s) =1/2

    s+ a+ jb+

    1/2

    s+ a− jb. (6)

    The corresponding discrete-time filter has a transfer function given by

    H(z) =1/2

    1− e−(a−jb)t0z−1+

    1/2

    1− e−(a+jb)t0z−1, (7)

    or

    H(z) =B(z)

    A(z)=

    1− e−at0cos(bt0) z−1

    1− 2e−at0cos(bt0) z−1 + e−2at0 z−2(8)

  • Impulse Invariance Example (2)

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 12 / 29

    Pole and Zero Locations

  • Approximation of Derivatives

    ❖ Lecture 8 Outline

    Introduction

    Method: ImpulseInvariance for IIR FIlters

    Approximation ofDerivatives❖ Method:Approximation ofDerivatives❖ Approximation ofDerivatives (2)

    ❖ Approximation ofDerivatives (3)

    Bilinear Transform

    Matched Z-Transform

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 13 / 29

  • Method: Approximation of Derivatives

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 14 / 29

    This explanation is a plausibility argument, not a rigorous proof.

    Start with an analog filter with system function H(s) expressed in rational formwith constant coefficients:

    H(s) =

    ∑Mk=0 βks

    k

    ∑Nk=0 αks

    k. (9)

    In the time domain, this is equivalent to the differential equation

    M∑k=0

    αkdky(t)

    dtk=

    N∑k=0

    βkdkx(t)

    dtk. (10)

    But we can approximate a derivative by a backward difference:

    dy(t)

    dt|t=nt0

    ∼=y(nt0)− y(nt0 − t0)

    t0=

    y[n]− y[n− 1]

    t0. (11)

  • Approximation of Derivatives (2)

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 15 / 29

    The left hand and right hand sides of eqn(11) represent a continuous time anddiscrete time system which are supposed to be equivalent:

    y[n]−y[n−1]t0

    dydt

    y(t)

    y[n]H(z) = 1−z

    −1

    t0

    H(s) = s

    For both systems to be equivalent, we must have the following mapping:

    s =1− z−1

    t0. (12)

    This relationship between s and z holds for all orders of the derivative, with sreplaced by skand the first order difference replaced by the k-th order difference.Hence it holds for the system described by eqn (10).

  • Approximation of Derivatives (3)

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 16 / 29

    Solving previous for z:

    z =1

    1− st0(13)

    This is one mapping between the s and z-planes. It maps the entire LH plane ofthe s-plane into a circle centered at z=[1/2,0] and radius 1/2. It is not a usefulmapping if you want to create a digital filter with poles in other regions inside theunit circle. However, there is no aliasing.

  • Bilinear Transform

    ❖ Lecture 8 Outline

    Introduction

    Method: ImpulseInvariance for IIR FIlters

    Approximation ofDerivatives

    Bilinear Transform❖ Method: BilinearTransform

    ❖ Bilinear Transform (2)

    ❖ Bilinear Transform -Pre-warping

    ❖ Bilinear Transform -Pre-warping (2)

    ❖ Design Example forSecond Order Section❖ Second-order Section(2)

    ❖ Second-order Section(3)

    ❖ Alternative to ThePrevious Two Slides:Matlab❖ What to Do Now?(Reminder from Lecture7)

    Matched Z-Transform

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 17 / 29

  • Method: Bilinear Transform

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 18 / 29

    BLT is the standard method for designing digital filters ”by hand”. Like theprevious method (Approximating Derivatives), it is based on an approximatesolution of the continuous-time equation (11), but instead of approximating thederivative(s), it approximates integrals using the Trapezoidal Rule.

    Consider the system

    c1y′

    a(t) + c0ya(t) = d0x(t), (14)

    with system function H(s) given by:

    Ha(s) =d0

    c1s+ c0. (15)

    Express ya(t) as an integral of y′a(t):

    ya(t) =

    ∫ tτ

    y′a(t) dt + ya(τ ), (16)

    and let t = nt0 and τ = (n− 1)t0 .

  • Bilinear Transform (2)

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 19 / 29

    Then (see Oppenheim and Schafer), using the Trapezoidal Rule to approximatethe integral, (16) can be written:

    ya(nt0) = ya((n− 1)t0) +t02[y′a(nt0) + y

    a((n− 1)t0). (17)

    Substituting for y′a(nt0) from equation (14) and using y[n] = y(nt0), we have :

    (y[n]− y[n− 1]) =t02[−

    c0c1(y[n] + y[n− 1]) +

    d0c0

    (x[n] + x[n− 1])]. (18)

    Taking the z-transform of this equation and using the fact thatZ{y[n− 1]} = z−1Y (z), ..., we get

    H(z) =Y (z)

    X(z)=

    d0

    c12t0

    1−z−1

    1+z−1 + c0. (19)

  • Bilinear Transform - Pre-warping

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 20 / 29

    Comparing (19) to (15): H(z) = Ha(s)|s= 2t0

    1−z−1

    1+z−1

    , i.e. the discrete-time transform

    will equal the continuous time transform if

    s =2

    t0

    1− z−1

    1 + z−1. (20)

    Substituting s = jΩ and z = ejω and using the definition

    tan(x) =sin(x)

    cos(x)= j

    ejx − e−jx

    ejx + e−jx, (21)

    we get the following relation between Ω and ω :

    Ω =2

    t0tan(

    ω

    2). (22)

  • Bilinear Transform - Pre-warping (2)

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 21 / 29

    The relation between Ω and ω and the mapping between s- and z-planes areshown below:

    Note that the bilinear transform maps the entire left-hand s-plane to the interior ofthe unit circle of the z-plane, and that higher frequencies along the jΩ axis arecompressed compared with frequencies near 0.

  • Design Example for Second Order Section

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 22 / 29

    A second-order analog filter section has a transfer function given by

    Ha(s) =Ω2n

    s2 + 2ζΩns+Ω2n, (23)

    where Ωnis the natural frequency and ζ is the damping constant. ζ < 1 isunderdamped and ζ > 1 is overdamped. For small values of ζ, the system hastwo poles at α1,2 = −ζΩn ± jΩn, i.e. the filter will ring and have a peak responseat frequency Ωn.

    Assuming we want to design a digital filter with a peak response at ωn, we firstneed to determine what Ωn is needed using (22). Then we can substitute for s inthe equation for Ha(s) using (20).

  • Second-order Section (2)

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 23 / 29

    One direct solution (messy, not as pretty as the next one):

    H(z) = GB(z)

    A(z)=

    Γ2

    Γ2 + 4Γζ + 4

    1 + 2z−1 + z−2

    1 + 2 (Γ2−4)

    Γ2+4Γζ+4z−1 + Γ

    2−4Γζ+4Γ2+4Γζ+4z

    −2, (24)

    Where Γ = Ωnt0 is the pre-warped discrete-time natural frequency and G is the”gain factor”. This solution doesn’t explicitly show the pole locations (andprobably could be simplified), but it is in the form such that a filter section couldbe implemented.

  • Second-order Section (3)

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 24 / 29

    Mike’s nicer direct solution: after some algebra, we get the digital filter transferfunction

    H(z) =B(z)

    A(z)= G

    (1 + z−1)(1 + z−1)

    (1− pz−1)(1− p∗z−1), (25)

    where the gain G is given by

    G =tan2(Ωnt0/2)

    1 + 2ζtan(Ωnt0/2) + tan2(Ωnt0/2)(26)

    and the pole location is given by

    p =1− tan(Ωnt0/2)e

    jcos−1(ζ)

    1 + tan(Ωnt0/2)ejcos−1(ζ)

    (27)

  • Alternative to The Previous Two Slides:Matlab

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 25 / 29

    “Syntax

    [zd,pd,kd] = bilinear(z,p,k,fs)[zd,pd,kd] = bilinear(z,p,k,fs,fp)[numd,dend] = bilinear(num,den,fs)[numd,dend] = bilinear(num,den,fs,fp)[Ad,Bd,Cd,Dd] = bilinear(A,B,C,D,fs)[Ad,Bd,Cd,Dd] = bilinear(A,B,C,D,fs,fp)

    Description

    The bilinear transformation is a mathematical mapping of variables. In digital fil-tering, it is a . . . ”

    http://www.mathworks.com/help/signal/ref/bilinear.html

    http://www.mathworks.com/help/signal/ref/bilinear.html

  • What to Do Now? (Reminder from Lecture7)

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 26 / 29

    Input a and b coefficients into this (Direct Type II) or other configuration (Type I,Transposed Type II)

    H(z) = H2(z)H1(z) =1

    A(z)B(z) (28)

    +

    + +

    + +

    + +

    +

    z -1

    z -1

    z -1

    b[0]

    b[1]

    b[2]

    b[N-1]

    b[N]

    -a[1]

    -a[2]

    -a[N]

    -a[N-1]

    x[n] y[n]

    s1[n]

    s2[n]

    sN-1[n]

    sN[n]

    v[n]

  • Matched Z-Transform

    ❖ Lecture 8 Outline

    Introduction

    Method: ImpulseInvariance for IIR FIlters

    Approximation ofDerivatives

    Bilinear Transform

    Matched Z-Transform❖ Method: MatchedZ-Transform❖ Summary of Analog→ DigitalTransformation

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 27 / 29

  • Method: Matched Z-Transform

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 28 / 29

    This method directly maps the poles and zeros of an analog filter directly intopoles and zeros of the z-plane. We start with the transfer function of the analogfilter in factored form:

    Ha(s) =

    ∏Mk=1(s− zk)∏Nk=1(s− pk)

    . (29)

    The transfer function of the equivalent digital filter is obtained by replacing termsof the form (s− a) with (1− eat0z−1). This is called a ’matched z’ transform andgives the same pole location as impulse invariance but different zero location.

  • Summary of Analog → DigitalTransformation

    Colorado State University Dept of Electrical and Computer Engineering ECE423 – 29 / 29

    Technique Mapping +/-

    ImpulseInvariance

    z = est0 + Preserves shape of filter;- Aliasing

    Approximationof Derivatives

    s = 1−z−1

    t0+ No aliasing;- Restricted pole location, shapedistortion

    BilinearTransform

    s = 2t0

    1−z−1

    1+z−1 + No aliasing;- Shape distortion

    Matched Ztransform

    (s− a) → (1− eat0) + Directly maps pole and zerolocations;- Aliasing

    Lecture 8 OutlineIntroductionIIR Filter Design Overview

    Method: Impulse Invariance for IIR FIltersImpulse InvarianceImpulse Invariance (2)Impulse Invariance (3)Impulse Invariance (4)Impulse Invariance ProcedureImpulse Invariance ExampleImpulse Invariance Example (2)

    Approximation of DerivativesMethod: Approximation of DerivativesApproximation of Derivatives (2)Approximation of Derivatives (3)

    Bilinear TransformMethod: Bilinear TransformBilinear Transform (2)Bilinear Transform - Pre-warpingBilinear Transform - Pre-warping (2)Design Example for Second Order SectionSecond-order Section (2)Second-order Section (3)Alternative to The Previous Two Slides: MatlabWhat to Do Now? (Reminder from Lecture 7)

    Matched Z-TransformMethod: Matched Z-TransformSummary of Analog Digital Transformation