Dizitization of analog fiters

Embed Size (px)

Citation preview

  • 8/9/2019 Dizitization of analog fiters

    1/5

    Assignment #2: Digitisation of Analog Filters

    Mohammed Alamgir

    December 7, 2013

    Problem

    An elliptic filter with specifications

    1 = 3000Hz, K 1 = 1dB,

    2 = 5000Hz, k2 = 30dB

    0 = 24335 rad/sec

    has been designed to have the low-pass prototype transfer function

    Hprot(s) = 0.03s4 + 0.212s2 + 0.234

    s4 + 0.828s3 + 1.245s2 + 0.595s+ 0.278 (1)

    and after the transformation s s/24335 the final transfer function

    Hdes(s) = 8.55

    1020

    s4

    + 3.58

    1010

    s2

    + 0.2342.85 1018s4 + 5.74 1014s3 + 2.10 109s2 + 2.4 105s+ 0.278

    . (2)

    Find the transfer function of equivalent digital filters using: mapping of differentials, impulseinvariant transformation, bilinear transformation, and matched-z transformation methods.

    1 Mapping of Differentials

    In this method two kinds of differentials: backward and forward are mapped for variable s. Inbackward mapping s is replaced by s = (1 1/z)/T, and in forward mapping s is replaced by(z 1)/T, where T is a suitable sampling interval. For the given filter, we have 0 = 24335rad/sec. We must use a sampling frequency of at least twice that to avoid aliasing. For simplicity

    let us take s= 20 50000 rad/sec. This gives a Tvalue of/25000.Using substitutions s 25000(1 1/z)/ and s 25000(z 1)/ result in the transfer

    functions of the equivalent digital filter. Using Wolfram Alpha one finds:

    Hmdback(z) =3.4 104z4 1.37 103z3 + 2.47 102z2 4.6 102z1 + 0.257

    1.14 102z4 7.46 102z3 + 0.288z2 0.589z1 + 0.643358 (3)

    1

  • 8/9/2019 Dizitization of analog fiters

    2/5

    0 500 1000 1500 2000 2500 3000 35000

    20

    40

    60

    Frequency (Hz)

    Phase(degrees)

    0 500 1000 1500 2000 2500 3000 350015

    10

    5

    0

    Frequency (Hz)

    Magnitude(dB

    )

    Freq and Phase response: Mapping of Diff Backward; T =/25000

    Figure 1: Transfer function of digitised filter(backward difference).

    0 500 1000 1500 2000 2500 3000 350040

    20

    0

    20

    40

    Frequency (Hz)

    Phase(degrees)

    0 500 1000 1500 2000 2500 3000 35005

    0

    5

    10

    Frequency (Hz)

    Magnitude(dB

    )

    Freq and Phase response: Mapping of Diff Forward; T =/25000

    Figure 2: Transfer function of digitised filter(forward difference).

    and

    Hmdfor(z) =3.4 104z4 1.37 103z3 + 2.47 102z2 4.6 102z1 + 0.257

    1.14 102z4 1.69 102z3 + 0.115z2 0.0345z1 + 0.2027 . (4)

    We note that the formulae are slightly different. Plots of these functions are shown in Fig.1 andFig.2.

    It is known that this method results in unequal gains in the pass band and distorted phase,which is evident in Fig.1. The forward difference results in serious distortions in gains but somewhat

    linear phase response (Fig.2).

    2 Impulse Invariant Transformation

    The Impulse invariant method works by rearranging the transfer function as partial fractions andthen converting each fraction to its discrete equivalent. Using MATLABs residue() commandon eq.(1) one gets

    Hprot(s) = 0.03 +j0.06

    s+ 0.07j0.8+ 0.03j0.06

    s+ 0.07 +j0.8+

    0.02j0.3

    s 0.3j0.4

    0.02 +j0.3

    s 0.3 +j0.4+ 0.03 (5)

    which after the substitutions of the form 1s+p 1

    1z1epT in each fraction becomes

    Hprot(z) = 0.03 +j0.06

    1 z1e(0.07j0.8)T+

    0.03j0.06

    1 z1e(0.07+j0.8)T+

    0.02j0.3

    1 z1e(0.3+j0.4)T0.02 +j0.3

    1 z1e(0.3j0.4)T+0.03

    (6)

    2

  • 8/9/2019 Dizitization of analog fiters

    3/5

    0 500 1000 1500 2000 2500 3000 3500300

    200

    100

    0

    Frequency (Hz)

    Phase(degrees)

    0 500 1000 1500 2000 2500 3000 350020

    10

    0

    10

    Frequency (Hz)

    Magnitude(dB)

    Freq and Phase response using Impulse Invariant Trans; T =/25000

    Figure 3: Transfer function of the digitisedfilter when sampled at twice the cut-off fre-quency using Impulse Invariant method.

    0 500 1000 1500 2000 2500 3000200

    150

    100

    50

    0

    Frequency (Hz)

    Phase(degrees)

    0 500 1000 1500 2000 2500 30005

    0

    5

    10

    Frequency (Hz)

    Magnitude(dB

    )

    Freq and Phase response using Impulse Invariant Trans; T =/20000

    Figure 4: Transfer function of the digitisedfilter when sampled at less than twice thecut-off frequency using Impulse Invariantmethod.

    Sampling at twice the cut-off frequency ( = 1), we have T = 2/2 = . The sampled transferfunction then becomes:

    Hprot(z) = 0.03 +j0.06

    1 z1e(0.07j0.8)+

    0.03j0.06

    1 z1e(0.07+j0.8)+

    0.02j0.3

    1 z1e(0.3+j0.4)0.02 +j0.3

    1 z1e(0.3j0.4)+0.03

    (7)

    Following same approach we have

    Hdes(s) = 928 +j1636

    s+ 18780 j21505+ 928j1636

    s+ 18780 +j21505+

    6264j8085

    s+ 81920 j11926+

    6264 +j8085

    s+ 81920 +j11926+0.03.

    (8)For the actual filter we takeT=/25000, and apply the substitution of the form 1s+p

    11z1epT

    to get the digitized transfer function. With the aid of Matlab, this function along with an under-sampled version are plotted in Fig.3 and Fig.4.

    3 Bilinear Transformation

    For the normalised filter we have T = . So to discretise the prototype filter we perform asubstitutions 2

    z1z+1 . Using Wolfram Alpha this is found to be

    Hprot(z) =0.21z4 + 0.59z3 + 0.86z2 + 0.59z+ 0.211

    z4 + 0.5z3 + 1.06z2 + 0.07z+ 0.221 (9)

    For the actual filter, we have T=/25000, so the transformation s 50000z1z+1 gives the discrete

    transfer function, namely:

    3

  • 8/9/2019 Dizitization of analog fiters

    4/5

    0 500 1000 1500 2000 2500 3000 3500400

    200

    0

    200

    Frequency (Hz)

    Phase(degrees)

    0 500 1000 1500 2000 2500 3000 3500100

    80

    60

    40

    20

    0

    Frequency (Hz)

    Magnitude(dB

    )

    Freq and Phase response using Bilinear Trans; T =/25000

    Figure 5: Transfer function of the digitisedfilter when sampled at twice the cut-off fre-quency using bilinear method.

    0 500 1000 1500 2000 2500 3000400

    200

    0

    200

    Frequency (Hz)

    Phase(degrees)

    0 500 1000 1500 2000 2500 300080

    60

    40

    20

    0

    Frequency (Hz)

    Magnitude(dB

    )

    Freq and Phase response using Bilinear Trans; T =/20000

    Figure 6: Transfer function of the digitisedfilter when sampled at less than twice thecut-off frequency using bilinear method.

    Hdes(z) =0.03z4 0.12z3 + 0.18z2 0.12z+ 0.03

    z4 + 4z3 + 6z2 4z+ 1 (10)

    With the help of Matlab, this function along with an under-sampled version are plotted inFig.?? and Fig.6.

    4 Matched-z Transform

    In this method the zeros and poles of the analog transfer function are mapped to correspondingzeros and pole in the digital domain.

    For the prototype transfer function in eq.(1) the zeros and poles are found using MATLABstf2zp() command. The zeros are found at j2.3 and j1.17. The poles are found at 0.07j0.89and 0.33j0.48. The transfer function is:

    Hprot(s) = 0.03(sj2.3)(s+j2.3)(sj1.17)(s+j1.17)

    (s+ 0.07j0.89)(s+ 0.07 +j0.89)(s+ 0.33 +j0.48)(s+ 0.33j0.48) (11)

    Ifa denotes either a zero or a pole, then the matched-z transform of the prototype transferfunctions is found with substitution s +a 1 z1ea where we used T=. Using MATLABsymbolic toolbox, one can find

    Hprot(z) = 0.031.72z3 1.02z2 + 0.546z1 + 1

    0.08z4 + 0.16z3 + 0.7z2 + 1.47z+ 1 (12)

    4

  • 8/9/2019 Dizitization of analog fiters

    5/5

    0 500 1000 1500 2000 2500 3000 3500100

    0

    100

    200

    Frequency (Hz)

    Phase(degrees)

    0 500 1000 1500 2000 2500 3000 3500100

    50

    0

    50

    Frequency (Hz)

    Magnitude(dB

    )

    Freq and Phase response using MatchedZ Trans; T =/25000

    Figure 7: Transfer function of the digitisedfilter when sampled at twice the cut-off fre-quency using matched-z method.

    0 500 1000 1500 2000 2500 3000 3500 4000 4500200

    100

    0

    100

    200

    Frequency (Hz)

    Phase(degrees)

    0 500 1000 1500 2000 2500 3000 3500 4000 450050

    0

    50

    Frequency (Hz)

    Magnitude(dB

    )

    Freq and Phase response using MatchedZ Trans; T =/30000

    Figure 8: Transfer function of the digitisedfilter when sampled at higher than twice thecut-off frequency using matched-z method.

    The transfer function of the desired filter in factored form is found as:

    Hdes(s) = sj58109

    s+ 18780 j21505

    s+j58109

    s+ 18780 +j21505

    sj28470

    s+ 81920 j11926

    sj28470

    s+ 81920 +j119260.03.

    (13)Using the substitution s+a 1 z1ea/25000, (a is either a zero or pole) in above equationgives the discrete form the transfer function.

    With the help of Matlab, this function along with an under-sampled version are plotted inFig.7 and Fig.8.

    We notice that the frequency response (Fig.7) has sudden deeps that were not present in theanalog version. Even when the sampling rate is increased the deeps are still present (Fig.4). Thisreinforces the fact that Matched-Z is not suitable for all kinds of filters.

    5 Remarks

    For this particular filter I conclude that the Bilinear Transform method gives the best digitalapproximation of the analaog transfer function.

    5