Curs DSP Complet

download Curs DSP Complet

of 123

Transcript of Curs DSP Complet

  • 8/9/2019 Curs DSP Complet

    1/123

    Difference equation representation of discrete time signals

    )()(0 0

    knxbknyaN

    k

    M

    k

    kk = = =

    , 0n (1)

    where kk ba , are known

    )()(0 0

    knxbknyaN

    k

    M

    k

    kk +=+ = =

    0n (2)

    NM for stable states

    Method I for finding the solution for the system:

    )()([1

    )0(0

    )()([1

    )(

    )()()(

    0 10

    0 10

    1 0

    0

    kyakxba

    yn

    knyaknxba

    ny

    knxbknyanya

    M

    k

    N

    k

    kk

    M

    k

    N

    k

    kk

    N

    k

    M

    k

    kk

    ==

    =

    =+

    = =

    = =

    = =

    where y(-k), n1,k= represents the initial condition for the differential equation and

    are assumed known.

    n=1 )1()1([1

    )1(0 10

    kyakxba

    yM

    k

    N

    k

    kk = = =

    where y(0) was

    earlier determined

    n=2 y(2)=

    DTSx(n) y(n)

    (H)

    Input signal

    (excitation)Output signal

    (response)

  • 8/9/2019 Curs DSP Complet

    2/123

  • 8/9/2019 Curs DSP Complet

    3/123

  • 8/9/2019 Curs DSP Complet

    4/123

    Solution:

    The characteristic equation is: 016

    1

    2

    1

    4

    51

    321 =+

    016

    1

    2

    1

    4

    5 23 =+ =>2

    121 == ,

    4

    13 =

    nnn

    h AAAny 332211)( ++= =nnn

    AAA

    +

    +

    4

    1

    3

    1

    2

    1321

    n= -1 , y(-1)=6

    321

    1

    3

    1

    2

    1

    1 4224

    1

    3

    1)1(

    2

    1)1( AAAAAAyh +=

    +

    +

    =

    n= -2 , y(-2)=6

    321

    2

    3

    2

    2

    2

    1

    16844

    1

    3

    1)2(

    2

    1)2( AAAAAAy

    h

    +=

    +

    +

    =

    n= -3 , y(-3)= -2

    321

    3

    3

    3

    2

    3

    1 642484

    1

    3

    1)3(

    2

    1)3( AAAAAAyh +=

    +

    +

    =

    The system6422 321 =+ AAA 2/91 =A61684

    321

    =+ AAAhas the following solutions:

    4/52 =

    A

    264248 321 =+ AAA 8/13 =A

    =)(ny hnnn

    +

    4

    1

    8

    1

    3

    1

    4

    5

    2

    1

    2

    9

    b). finding the particular solution of the differential equation (1)

    The particular solution )(ny p is obtained first by determining )(ny the particular

    solution of the equation )()(0

    nxknyaN

    k

    k=

    =

    Using of the principle of Superposition Theorem we can write the final particular

    solution:

    )()(1

    knybnyM

    k

    kp = =

  • 8/9/2019 Curs DSP Complet

    5/123

    If )()()( nyctnyctnx p== is a linear combination of the version x(n) and its

    delayed version x(n-1), x(n-2), ..

    )()()( nyknynx pnn == has the same form

    )(sin)(sin)( 00 knknxnnx == =knkn 0000 sincoscossin = nBnA 00 cossin +=

    ==> nBnAny p 00 cossin)( +=

    nnx 0cos)( = => )(cos)( 0 knknx = =nBnAknkn 000000 sincossinsincoscos +=+=

    ==> nBnAny p 00 sincos)( +=

    Example:

    Consider the differential equation:

    2sin2)2(

    8

    1)1(

    4

    3)(

    nnynyny =+ , with initial conditions:

    y(-1)=2 , y(-2)=4)()()( nynyny hp +=

    Solution:

    Finding the particular solution

    2

    cos2

    sin)( n

    Bn

    Anyp

    +=

    n= -1, y(-1)= 2 and )1()1( = yy p = - A

    n= -2 , y(-2)= 4 and )2()2( = yy p = 4

    2cos

    2sin)( nBnAny p +=

    2sin

    2cos

    2

    )1(cos

    2

    )1(sin)1(

    nB

    nA

    nB

    nAny p +=

    +

    =

    2cos

    2sin

    2

    )2(cos

    2

    )2(sin)2(

    nB

    nA

    nB

    nAny p =

    +

    =

    2sin2

    ]2

    sin2

    sin[8

    1)

    2sin

    2cos(

    4

    3

    2cos

    2sin

    n

    nB

    nA

    nB

    nA

    nB

    nA

    =

    =+++

    2sin2

    2cos)

    8

    1

    4

    3(2

    sin)8

    1

    4

    3( nnBABnABA =+

    The system

  • 8/9/2019 Curs DSP Complet

    6/123

    08

    1

    4

    3

    28

    1

    4

    3

    =

    =

    BAB

    ABA

    has the following solutions

    85

    96

    85

    112

    =

    =

    B

    A

    2cos85

    96

    2sin85

    112

    )(

    nn

    nyp =

    Find the homogeneous solution:

    08

    1

    4

    31 21 =+ => 0

    8

    1

    4

    32 =+ => 4/11 = , 2/12 =

    =>nnnn

    h DCDCny )2

    1()

    4

    1()( 21 +=+=

    )()()( nynyny hp += =>2

    cos85

    96

    2sin

    85

    112)

    2

    1()

    4

    1()(

    nnDCny

    nn ++=

    n= -1 => y(-1)=2=2

    cos

    85

    96

    2

    sin

    85

    112

    2

    1

    4

    111

    ++

    DC

    n= -2 => y(-2)=4 = )cos(85

    96)sin(

    85

    112

    2

    1

    4

    122

    ++

    DC

    The system has the following solutions:

    15

    13D4

    85

    964D16C

    17

    8-C2

    85

    1122D4C

    ==++

    ==++

    2cos

    85

    96

    2sin

    85

    112)

    2

    1(

    15

    13)

    4

    1(

    17

    8)(

    nnny nn ++=

    Example II

    Consider the differential equation

    )1(2

    1)()2(

    8

    1)1(

    4

    3)( +=+ nxnxnynyny with

    2sin2)(

    nnx = . Find the particular solution of the differential equation

    )1(2

    1)()( += nynyny ppp

    2cos

    85

    96

    2sin

    85

    112)(

    nnnyp =

    2)1(cos

    8596

    2)1(sin

    85112)1( = nnnyp

    2

    )1(cos

    85

    96

    2

    1

    2

    )1(sin

    85

    112

    2

    1

    2cos

    85

    96

    2sin

    85

    112)(

    +=

    nnnnnyp

    Finding the response of the system when )()( nnx =

  • 8/9/2019 Curs DSP Complet

    7/123

    )()(0 0

    knbknyaN

    k

    M

    k

    kk = = =

    (3)

    0;1)( == kn knkn == ;1)(

    0;0)( = kn knkn = ;0)(With y(-1)=0

    y(-2)=0 0n.

    For Mn > the right side of the eq.(3) is 0 so we have the homogeneous equationThe N initial conditions are y(M);y(M-1);y(M-N+1)

    Since MN for a causal system we have to determine only y(0); y(1); ; y(n).But M1,n = and y(k)=0 if 0 M , =

    =M

    k

    hk nyknya0

    )(0)(

    Example

    )1(2

    1)()2(

    8

    1)1(

    4

    3)( +=+ nnnynyny

    Solution:

    N=2; M=1

    2n homogeneous equation: 0)2(8

    1)1(

    4

    3)( =+ nynyny

    08

    1

    4

    31 21 =+ =>2

    11

    = ,3

    12 = ==>

    nn

    h AAny )4

    1()

    2

    1()( 21 +=

    [ ]01

    0 0

    aa

    a =

    )1(

    )0(

    y

    y

    1

    0

    b

    b=> [ ]

    04/3

    01

    =

    )1(

    )0(

    y

    y

    1

    0

    b

    b=>

    011

    0

    012

    01

    0

    . . . . .

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

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

    0. . . . . . .1. . . .

    0. . . . . . .1. . . . . . .

    0. . . . . . .1. . . . . . . .0

    aaaa

    aa

    aaa

    aa

    a

    MM

    M

  • 8/9/2019 Curs DSP Complet

    8/123

    =

    )1(

    )0(

    y

    y

    2

    1

    1

    ;

    =

    =

    4

    5)1(

    1)0(

    y

    y

    =>

    =+

    =+

    4|4

    5

    4

    1

    2

    1

    1

    21

    21

    AA

    AA

    =+

    =+

    52

    1|1

    21

    21

    AA

    AA

    =

    =

    4

    3

    2

    1

    A

    A

    nn

    h ny )4

    1(3)

    2

    1(4)( =

    Proof

    )1(2

    1)0()2(

    8

    1)1(

    4

    3)0(0n +=+= yyy

    )0(2

    1)1()1(

    8

    1)0(

    4

    3)1(1n +=+= yyy

    Response at the )()( nunx = of the discrete

    time system )()(0

    knhxnyk

    k =

    =,

    =

    =

    ==00

    )()()()()(k

    kkkn

    k

    kknukuknukuny

    =

    =0

    1 )()()(k

    kn kuny , with 0)0( =y for 0

  • 8/9/2019 Curs DSP Complet

    9/123

    0n , = => =

    +==n

    k

    kn nny0

    )1()1()(

    0n , =>

    =

    =

    ==

    ++

    =

    11

    01

    11

    )(1

    )(1)()(

    nnn

    n

    k

    nnknny

    = 1

    =+

    1

    1)(

    1nnny

    If = )()( nunx =

    =N

    k

    khns0

    )()(

    Example )(3

    1)( nunh

    n

    =

    =>=+=

    )10(

    )6()(2)]10()6([)]6()([2)(

    nu

    nununununununx

    106 )3

    1()

    3

    1()

    3

    1(2)( = nnnns 50 n

    =

    =n

    k

    kny0

    )3

    1(2)(

    =

    ==n

    k

    nk

    0

    )3

    1(3)

    3

    1(2

    106 n ==n

    kny

    0....................)(

    => 10n =

    =n

    k

    ny0

    ....................)(

    Discrete Time System (DTS)

    Definition:DTS is a device or an algorithm that operates on a discrete time signal called the

    input (excitation) according to some well defined rules to produce another discrete

    time signal called the output (response)of the system.

    H)()( nynx

    = 9n61

    6n02)(nx

  • 8/9/2019 Curs DSP Complet

    10/123

    Example

    Determine the response of the following system to the input signal :

    a). y(n) = x(n)

    b). y(n) = x(n-1)

    c). y(n) = x(n+1)

    d). y(n) = 1/3 [x(n+1)+x(n)+x(n-1)]

    e). y(n) = max[x(n+1), x(n), x(n-1)]

    f). =

    +++==n

    k

    nxnxnxkxny0

    .....)2()1()()()(

    V

    n .. -5 -4 -3 -2 -1 0 1 2 3 4 5

    x(n) 0 0 3 2 1 0 1 2 3 0 0

    a 0 0 3 2 1 0 1 2 3 0 0

    b 0 0 0 3 2 1 0 1 2 3 0

    c 0 3 2 1 0 1 2 3 0 0 0

    d 0 1 5/3 2 1 2/3 1 2 5/3 1 0

    e 0 3 3 3 2 1 2 3 3 3 0

    f 0 0 0 3 5 6 7 9 12 12 12

    d). n=0 y(0)=1/3[x(1)+x(0)+x(-1)]= 1/3(1+0+1) => y(0)=2/3

    n=1 y(1)=1/3[x(2)+x(1)+x(0)] = 1/3 (2+1+0) => y(1) = 1

    e). max [x(x+1), x(n), x(n-1) ]

    n=0 y(0)=max[1,0,1]=1n=1 y(1)=max[2,1,0]=2

    f). =

    =n

    k

    kxny0

    )()(

    =

    o t h e0

    3n3-)(

    nnx

  • 8/9/2019 Curs DSP Complet

    11/123

    n=0 y(0)=6

    n=1 y(1)=7

    =

    =

    +=+==n

    k

    n

    k

    nxnynxkxkxny )()1()()()()(1

    Building blocks for implementation of DTS (discrete time system)

    =

    =n

    k

    nxny1

    )()(

    Multiplier with a constant of a system :

    )(nx ____ ______)(ny )()( nxny =

    For convenience

    x(n) ____ _____y(n)

    )(nx )(ny

    Unit delay

    )(nx _____ ____)1( nx

    for convenience

    )(nx _________

    _________ )1( nx

    Advance unit

    )(nx ________ __________)1( nx

    Figura ce include x1 ,xk si y

    Unit

    delay

    1z

    z

  • 8/9/2019 Curs DSP Complet

    12/123

    Example:

    Using the basic building blocks, sketch the block diagram representation of a

    discrete time system described by a equation

    )1(2

    1)(

    2

    1)1(

    4

    1)( ++= nxnxnyny where )(nx is the input signal and )(ny is the

    output signal .

    )(nx _____DTS_____ )(ny

    Solution:

    METHOD 1: We write directly the equation:

    )1(4

    1)1(

    2

    1)(

    2

    1)( ++= nynxnxny

    Figura1z 1/2

    )(nx + +)(ny

    1z

    METHOD 2:

    [ ] )1(4

    1)1()(

    2

    1)( ++= nynxnxny

    Figura 1z

    1/2

    )(nx + + )(ny

    1/41

    z

    Clock frequency: nnx =)( or nn =)(

    Function generator

  • 8/9/2019 Curs DSP Complet

    13/123

    [ ])(),...,(),()( 21 nxnxnxfny k=

    Exemplul 1

    Figura

    Exemplul 2

    1

    )1()()(

    0=

    +=

    y

    kykuky ; =)(ku 0 for k0

    k=0: +=+= 11)1( 0yyk=1: 21 11)2( ++=+= yy..

    k : =++++= kky ...1)( 2

    + +

    1

    1 1kwhen 1 and

    1+k when 1=

    )()1(1)1()( kukykyky +=+= )()(...)2()1()( 21 kunkybkybkybky n =++++

    -differential equation of a DTS

    Figura)(1 nx

    f y(n)

    )(nxk

    Figura

  • 8/9/2019 Curs DSP Complet

    14/123

    Structures of a DTS

    -Recursive system

    -in time domain

    )()(0 0

    knxbknyaN

    k

    M

    k

    kk =

    = =NM for a causal system .It is difficult to work in the time domain, so we apply the Z transform

    )(nx ____________ )(zX )( knx _______ )(zXz

    k

    )()(0 0

    zXzbzYza kN

    k

    M

    k

    k

    k

    k

    = =

    = ;

    )(zX ______ ________ )(z

    =

    =

    =N

    k

    k

    k

    M

    k

    k

    k

    za

    zb

    zX

    zYzH

    0

    0

    )(

    )()( -transfer function

    -Non recursive system

    10 =a : )()()(1 0

    knxbknyany

    N

    k

    M

    k

    kk =+ = = )()()(

    1 0

    knxbknyanyN

    k

    M

    k

    kk += = =

    -by passing to Z transform we get :

    )()()(1 0

    zXzbzYzazY kN

    k

    M

    k

    k

    k

    k

    = =

    +=

    =

    =

    += N

    k

    k

    k

    M

    k

    k

    k

    za

    zb

    zX

    zYzH

    1

    0

    1)(

    )()( ; where H(z) is the transfer function

    )()()( 21 zHzHzH =

    kM

    k

    kzbzH

    ==

    0

    1 )( gives all the 0s of the transfer function H(z)

    )(zH

  • 8/9/2019 Curs DSP Complet

    15/123

    =

    +=

    N

    k

    k

    kza

    zH

    1

    2

    1

    1)(

    gives all the poles of the transfer function H(z)

    Observation|:

    )()()()()()( 21 zXzHzHzXzHzY ==

    Implementation

    -Direct Form 1 for implementation of DTS)()()( 1 zXzHzV =)()()( 2 zHzVzY =

    -Direct Form 2 for implementation of DTS)()()( 2 zXzHzW =)()()( 1 zHzWzY =

    Particular cases

    -first order structures

    )1()()1()( 101 ++= nxbnxbnyany => 11

    1

    10

    1)(

    ++

    =za

    zbbzH

    Direct form 1)1()()( 10 += nxbnxbnv

    )()1()( 1 nvnyany +=-2 adders

    -2 unit delays-3 multipliers

    Direct form 2 (regular)

    )1()()( 1 = nwanxnw)()1()( 01 nwbnwbny +=

    -2 adders

    -2 unit delays

    -3 multipliers

    -2 adders

    -1 unit delay

    -3 multipliers

    Figura Direct form I

    Figura Direct form II

    =>Figura

  • 8/9/2019 Curs DSP Complet

    16/123

    -second order structures

    )2()1()()2()1()( 21021 +++= nxbnxbnxbnyanyany

    => 2211

    2

    2

    1

    10

    1)(

    ++

    ++=

    zaza

    zbzbbzH

    Direct form 1

    )2()1()()( 210 ++= nxbnxbnxbnv

    )()1()2()( 12 nvnyanyany +=

    Direct form 2

    )2()1()()( 21 = nwanwanxnw

    )2()1()()(210 ++=

    nwbnwbnxbny

    Signal Graph of direct form 2

    )()()( 0 nwnxbny +=

    )1()1()( 111 = nyanwbnw)2()2()( 222 = nyanxbnw

    Transpose graph (overturn the previous)

    Figura

    Implementation of transpose graph

    Figura

    Figura

    Figura

  • 8/9/2019 Curs DSP Complet

    17/123

    Signal graph (obtained by overturning once more)

    )()()( 0 nxnwbny +=

    )1()1()( 11 = nyanwbnw )2()2()( 221 = nyanxbnw

    Transpose Direct Form 2 (for reducing the summation circuits)

    Direct Form 1 Implementation

    )()(0

    knxbnvM

    k

    k=

    =

    )()()(1

    knyanvnyN

    k

    k += =

    Figura

    Figura

    Figura

    Figura

  • 8/9/2019 Curs DSP Complet

    18/123

    Direct Form 2 (regular)

    Figura

    )()()(1

    knyanxnwN

    k

    k = =

    )()(1

    knwbnvM

    k

    k = =

    grad M< grad N

    Transpose Direct Form 2

    Figura

    Figura

  • 8/9/2019 Curs DSP Complet

    19/123

    Homework:

    Given the transfer function H(z), find its regular form and transpose

    21

    21

    125.075.01

    21)(

    +++

    =zz

    zzzH

    Hint! See the coefficients; make implementation

    METHOD 3:

    Cascade form

    +=

    Mk

    k

    Nk

    k

    za

    zbzH

    1

    0

    1

    )( ; (the numerator has the degree M, the denominator- N)

    If Rba kk , then all poles and zeros are complex conjugate

    )1()1()1(

    )1)(1()1(

    )(1*

    1

    1

    1

    1

    1

    1*1

    1

    1

    21

    21

    =

    =

    =

    =

    =

    zdzdze

    zbzbzg

    zH

    k

    N

    k

    k

    N

    k

    k

    M

    k

    kk

    M

    k

    k

    Where 21 2MMM += 21 2NNN +=

    ke -real poles

    kg -real zeros*

    , kk bb -complex zeros*, kk dd -complex poles

    For a causal system 1

  • 8/9/2019 Curs DSP Complet

    20/123

    =

    =1

    1

    1

    2 )1()(N

    k

    kzezH

    ),min( 22 MNNs =

    Figura

    Implementation of )(3 zH

    Figura

    Homework :

    Implement the structure of the DTS described by the ecuation

    )25.01)(5.01(

    )1(

    125.075.01

    21)(

    11

    21

    21

    21

    +=

    +

    ++=zz

    z

    zz

    zzzH ;

    Solution)()()( 21 zHZHzH =

    1

    1

    15.01

    1)(

    +

    =z

    zzH

    1

    1

    225.01

    1)(

    +

    =z

    zzH

    a)Direct Form 2

    b)Direct Form 1 - subsections

    Figura

    Figura

  • 8/9/2019 Curs DSP Complet

    21/123

  • 8/9/2019 Curs DSP Complet

    22/123

    1

    ( ) ( )k

    k

    k

    H z C H z =

    = +

    k-integer part of1

    2

    N+

    1 2 1

    1 1 *

    (1 )

    1 (1 )(10 1 1

    ( )p

    k k k

    k k k

    N N N A B e z k

    k C z d z d z k k k

    H z C z

    = = =

    = + + 1 2

    N N N = +

    - if M N then p N M N =

    - if ,k ka b then , , , ,k k k k k A B C c e and the system function can beinterpreted as representing a parallel combination of first and second order systems

    with pN possible delay paths.

    Second method:

    Grasping the real poles in pairs, then 10 1

    1 21 1 2

    ( )1

    p sN N

    k k kk

    k o k k k

    e e z H z C z

    a z a z

    = =

    += +

    , where sN is integer part of1

    2

    N+

    The general difference equations for the parallel form with second order direct form

    II sections are:

    1 2( ) ( 1) ( 2) ( );k k k k k W n a W n a W n x n= + + k=1, sN 0 1( ) ( ) ( 1)k k k k k y n e W n e W n= +

    0 1

    ( ) ( )p sN N

    n k k

    k k

    y C x n k y n= =

    = + Example: Parallel form structure for a sixth order system with real and complex

    poles grasped in pairs.

    (N=M=6)

  • 8/9/2019 Curs DSP Complet

    23/123

    E.g. H(z)=1 2 1

    1 2 1 2

    1 2 7 88

    1 0.75 0.125 1 0.75 0.125

    z z z

    z z z z

    + + += +

    + +

    a) parallel structure using 2nd order system

    b) H(z)= 1 118 25

    81 0.05 1 0.25z z

    + c)

    Parallel structure using first order system

  • 8/9/2019 Curs DSP Complet

    24/123

    Example: Determine the cascade and parallel structure for the system described by

    the transfer function

    1 1 1

    1 1 1 1

    1 210(1 )(1 )(1 2 )

    2 3( )3 1 1 1

    (1 )(1 ) 1 ( ) 1 ( )4 8 2 2 2 2

    z z z

    H z j j

    z z z z

    +=

    +

    a) Cascade implementation

    1 2( ) 10 ( ) ( )H z H z H z =

    1

    11 2

    21

    3( )7 3

    18 32

    z

    H z

    z z

    =

    +

    1 2

    21 2

    31

    2( )1

    12

    z zH z

    z z

    + =

    +

  • 8/9/2019 Curs DSP Complet

    25/123

    b) parallel implementation

    3 31 2

    1 1 1 1

    ( )3 1 1 1

    1 1 1 14 8 2 2 2 2

    A AA AH z

    j jz z z z

    = + + + +

    1 1

    1 2 1 2

    14.75 12.91 24.5 26.82( )

    7 3 11 1

    8 32 2

    z zH z

    z z z z

    += +

    + +

    1A =29.3; 3A =12.25-14.57j

    2A =-17.68; 3 12.25 14.57A j = +

    Exam problems:

    1) Obtain the direct form I, direct form II, cascade, parallel and lattice structures

    for the following systems

    a)3 1 1

    ( ) ( 1) ( 2) ( ) ( 1)4 8 3

    y n y n y n x n x n= + +

    b) ( ) 0.1 ( 1) 0.72 ( 2) 0.7 ( ) 0.252 ( 2)y n y n y n x n x n= + +

    c) ( ) 0.1 ( 1) 0.2 ( 2) 3 ( ) 3.6 ( 1) 0.6 ( 2)y n y n y n x n x n x n= + + + +

  • 8/9/2019 Curs DSP Complet

    26/123

    d)1 1

    ( ) ( 1) ( 2) ( ) ( 1)2 4

    y n y n y n x n x n= + + +

    e)1

    ( ) ( 1) ( 2) ( ) ( 1) ( 2)2

    y n y n y n x n x n x n= + +

    f)1 1 2

    1 1 2

    2(1 )(1 2( )

    (1 0.5 )(1 0.9 0.81 )

    z z z H z

    z z z

    + +=

    + +

    2) For1 2 3 4( ) 1 2.88 3.404 1.74 0.4H z z z z z = + + + + sketch the direct form and lattice

    structure and find the corresponding input output implementations.

    3) Determine a direct form of implementation for the systems

    a) { }( ) 1, 2,3, 4, 3, 2,1h n =b) { }( ) 1, 2,3,3, 2,1h n =

    4) Determine the transfer function and the impulse response of the systems

    drawn below:

    a)

    b)

  • 8/9/2019 Curs DSP Complet

    27/123

    Lattice structure

    1

    1 1( )

    ( )1 ( )

    Nk N

    N

    k

    H za z

    a k z

    =

    = =+

    1

    ( ) ( ) ( ) ( )N

    N

    k

    g n a k y n k x n=

    = +

    B

    1

    0

    ( ) ( )M

    k

    k

    y n b x n k

    =

    = ( ) ( ) ( )x z h n y nuuuur z z

    1

    0

    ( ) ( )M

    k

    k

    k

    Y z b z x z

    =

    = ( ) ( ) ( )x z H z Y z uuuur1

    0

    ( )( )

    ( )

    Mk

    k

    k

    Y z H z b z

    X z

    =

    = = the response of the system for the unitsample is identical to the coefficients kb , i.e.:

  • 8/9/2019 Curs DSP Complet

    28/123

    { }( ) , 0 1nh n b n M =

    0 0

    ( ) 20 log 20 log

    k

    n B H j k

    = =

    2arg ( ) j k

    n H j e

    =

    a) Direct form structure (transversal structure)

    =

    =1

    0

    )()()(n

    k

    knxnhny

  • 8/9/2019 Curs DSP Complet

    29/123

    n-1 - memory locations for storing the M-1 previous inputs

    M - multipliers

    M-1 - adders of M-1 past values of the input and weighted current value of the input

    if h(n)=h(M-n-1) the system is SYMMETRICh(n)=-h(M-n-1) the system is ANTISYMMETRIC

    =

    =

    +

    +==

    1

    0

    12

    0 22)()()()()(

    M

    k

    M

    k

    Mnx

    Mhknxkhknxkhny

    +=

    +1

    12

    )()(M

    Mk

    knxkh

    2)()()(

    MnxhMhknxkh

    [ ]

    +++=

    = 22)()()()(

    12

    0

    Mnx

    MhkMnxknxkhny

    M

    k

    2

    Mmultiplications

    b) Cascade form structure

    =

    =k

    k

    k zHzH1

    )()(

    Example:

    Fourth order section in a cascade implementation of a symmetric system:

  • 8/9/2019 Curs DSP Complet

    30/123

    ( )( )43

    1

    2

    2

    1

    10*

    111*1

    0 1111)(

    ++

    ++=

    =

    zzc

    zczccz

    z

    z

    zzzzzczH

    k

    kkk

    k

    kkkk

    c) Lattice structure1,0);()( == MmzAmH mm

    The unit sample response of the mth system is:

    =

    +===

    =m

    k

    mmm knxknxmymkkkh

    h

    1

    0

    )()()()(;,1);()(

    1)0(

    Direct forms structure

    a)

    m(1) m(2) m(m-1) m(m)

    b)

    -m(1) -m(2) -m(m-1) -m(m)

    Analog Filters (Continuous in time)

  • 8/9/2019 Curs DSP Complet

    31/123

    An ideal frequency selective passes certain frequencies without any change while it

    stops the other frequencies completely.

    Types of Ideal Filters:

    LPF (Low Pass Filter)

    HPF (High Pass Filter)

    PBF (Pass Band Filter)

    SBF (Stop Band Filter)

    Types of Real Filters:

  • 8/9/2019 Curs DSP Complet

    32/123

    LPF 1-1 H(j) 1+1

    1-1 || p

    2 |H(j) | 1

    |s|

    1,2 - riple

    Bocle Diagrams:

    =

    =

    =

    n

    k

    l

    h

    m

    k

    l

    k

    ph

    hz

    ps

    zs

    csH

    1

    1

    )(

    )(

    )(

    s=j

    =

    =

    =

    m

    k

    l

    k

    m

    k

    l

    h

    pk

    zk

    pj

    zj

    cjH

    1

    1

    )(

    )(

    )(

    +=

    ==

    = =

    m

    k

    n

    k

    kpkkzk

    d

    dB

    pjlzjlc

    jHjH

    1 1

    ||log||loglog20

    |)(|log20|)(|

    dB

    jHjHjHjH dBdB

    32log102log202log20

    |)(|log20|)(|log20|)(|2

    1|)(|

    ==+

    +=

  • 8/9/2019 Curs DSP Complet

    33/123

    =

    0

    )(

    jHjH

    d

    n

    octave 2=b

    a

    ; decade 10=

    b

    a

    =

    00

    log20

    jjH

    dB

    n

    decadedBjHjH

    jHjHjHjH

    a

    a

    aadBbdBa

    b

    a

    2010log2010

    log20|)(|log20

    |)(|log20|)(|log20|)(||)(|10

    ==

    =

    ===

    octavedBjHjH dBbdBab

    a 62log20|)(||)(|2 ==

    Example:

    1) H (j)=k

    ( ) ( ) kjHkjHjH nn ==

    =

    0

    ( )

    =

    0,

    0,0a r g

    k

    kjHn

    ( )dBn

    jH ( )jHnarg

    ( ) dBkjHdBn

    log20=

    normalized transfer function

  • 8/9/2019 Curs DSP Complet

    34/123

    kkj

    kkk

    k

    ejjjH

    js

    ssH

    **)()(

    )(

    2===

    ==2)

    2

    00

    )(

    jkk

    n ejHjH

    =

    =

    Study of the digital filters

    1. Butterworth filters

    - we study the transfer function

    nssH

    +=

    1

    1)(

    ; substitution: js =

    nj

    jH)(1

    1)(

    +=

    -transfer function;

    Figura

  • 8/9/2019 Curs DSP Complet

    35/123

    n

    jH2

    1

    1)(

    +=

    -magnitude transfer function;

    njH

    2

    2

    1

    1)(

    +=

    -squared magnitude transfer function;

    Figura grafic Figura grafic

    Maximally flat approximation

    00

    )(=

    =

    k

    k

    d

    jHd

    ; 1,1 = nk

    nnH 422

    8

    3

    2

    11)( +=

    +

    dBH 32log202

    1log20)(log20

    1

    2 ====

    nn

    j

    sj

    sjs

    sHsHH22

    2

    1

    11

    1)()()(

    +

    ==+

    ==

    =

    Poles of

    2)(H

    are :

    n

    k

    nn

    j

    se

    j

    s

    j

    s2

    )12(

    22

    101

    ==

    =

    +

    ; 12,......,1,0 = nk

    n

    nkj

    k es2

    12 +

    =; 12,0 = nk -poles of squared magnitude transfer function;

  • 8/9/2019 Curs DSP Complet

    36/123

    n

    kj

    n

    k

    n

    kj

    n

    k

    n

    nkj

    n

    nksk

    2

    12cos

    2

    12sin

    22

    12sin

    22

    12cos

    2

    12sin

    2

    12cos

    +

    =

    =

    +

    +

    +

    =

    ++

    +=

    kkk js += , where

    n

    k

    nk

    k

    k

    2

    12cos

    212sin2

    =

    =

    Figure

    Example:

    n

    nkj

    k

    n

    es

    H

    n

    2

    12

    2

    2

    11)(

    3

    +

    =

    +=

    =

    ;

    6

    312

    5,0

    +

    =

    =k

    j

    k es

    k

    0=k 2

    3

    2

    13

    0 jesj

    +==

    ;

    1=k 2

    3

    2

    13

    2

    1 jesj

    +==

    ;

    2=k 12 ==j

    es;

  • 8/9/2019 Curs DSP Complet

    37/123

    3=k 2

    3

    2

    13

    4

    31jes

    j

    ==

    ;

    4=k 2

    3

    2

    13

    5

    41 jes

    j

    +==

    ;

    5=k 125 ==

    jes;

    The poles from the left plane:

    ( )

    ( ) ( )111

    12

    3

    2

    1

    2

    3

    2

    1

    1

    ))()((

    1)(

    2

    321 +++=

    +

    +

    =

    =sss

    sjsjs

    sssssssH

    TABLE 1

    n Butterworth polynomials(factored form)

    1 1+s2 122 ++ ss3 ( ) ( )11 2 +++ sss4 184776.1176536.0 22 ++++ ssss5 ( )119318.116180.0 22 +++++ sssss6 ( )( ( )19318.11215176.0 222 ++++++ ssssss7 ( )( )( )( )118022.112456.114450.0 222 +++++++ sssssss8 19622.116663.11111.113986.0

    2222

    ++++++++ ssssssss

    1.......)( 1

    1

    1 ++++=

    sasasasn

    n

    n

    n ;)(

    1)(

    ssH

    n=

  • 8/9/2019 Curs DSP Complet

    38/123

    TABLE 2

    Coefficients of butterworth polynomials

    n 1

    a 2

    a 3

    a 4

    a 5

    a 6

    a 7

    a 8

    a

    1 1

    2

    2 1

    3 2 2 1

    4 2.613 3.414 2.613 1

    5 3.236 5.236 5.236 3.236 1

    6 3.864 7.464 9.141 7.464 3.864 1

    7 4.494 10.10

    3

    14.60

    6

    14.60

    6

    10.10

    3

    4.494 1

    8 5.126 13.12

    8

    21.12

    8

    25.69

    1

    21.12

    8

    13.12

    8

    5.126 1

    Exercise:Design of a low-pass Butterworth filter

    11)( H ; p

    2)(

    11)( H ; p

    js = ; )()( jHsH

    2)(

    n

    nnn jssHjHsH

    =

    = )()()(

    n

    c

    c

    H 2

    2

    1

    1

    +

    =

    ;

    12

    1

    1

    1

    =

    +

    n

    c

    p

    (a)

    Figura grafic

  • 8/9/2019 Curs DSP Complet

    39/123

    n

    c

    p

    pnH2

    1

    1)(

    +

    =

    22

    1

    1

    =

    +

    n

    c

    s

    (b)

    n

    c

    s

    snH2

    1

    1)(

    +

    =

    ;

    ( ) 21

    2

    1

    11

    =

    +

    n

    c

    p

    ( )

    11

    12

    1

    2

    =

    n

    c

    p

    => =>

    2

    2

    2

    11

    =

    +

    n

    c

    s

    11

    2

    2

    2

    =

    n

    c

    s

    =>

    ( )( )

    2

    2

    2

    2

    2

    1

    2

    12

    1

    111

    =

    n

    s

    p

    =>

    ( )( ) ( )

    s

    p

    n

    log

    1111log

    2

    12

    2

    2

    1

    2

    2

    2

    1

    =

    (c)

    n - must be integer , choose nearest integer value

    If c

    is determined from equation (a), the PB specifications are met exactly,

    whereas the SB are exceeded.

    If c

    is determined from equation (b), the SB specifications are met exactly,

    whereas the PB are exceeded.

  • 8/9/2019 Curs DSP Complet

    40/123

    Steps in finding H(s) :

    1. Determine n from equation (c) using the values of sp ,21 ,, and round up

    to the nearest greater integer.

    2. Determine c from the equation (a) or (b).

    3. For the value of n determined at step 1. , determine the nominator of H(s) usingtable 1, table 2 or H(s).

    4. Find the )(sHn by replacing s withc

    s

    .

    Example:

    Design a BF (Butterworth filter) to have attenuation no more than 1dB for 1000rad/s and least 10 dB for 5000 rad/s.

    ( )

    = = 10lo g2011lo g20

    2

    1

    => == 31623.0

    108749.02

    1

    =

    =

    5000

    1000

    s

    p

    => 012.1=n . Round 2=n => 12

    1)(

    2 ++=

    sssH

    From equation (b) we have:

    n=2 => 75.28862 = rad/s

    22

    2

    275.288648.4082

    75.2886

    175.2886

    2

    75.2886

    1)(++=

    ++

    = ssss

    sHc

    n

    DESIGN METHOD

    Given: - the maximum pass band attenuation ( pA )

    - the minimum stop band attenuation ( sA )

    - the pass band edge frequency ( pf )

    - the stop band edge frequency ( sf )

    Find the transfer function H(s) of a Butterworth filter.

    p

    n

    c

    pA=

    +

    2

    1log10

  • 8/9/2019 Curs DSP Complet

    41/123

    s

    n

    c

    s A=

    +

    2

    1log10

    =>

    s

    p

    n

    c

    s

    n

    c

    p

    A

    A=

    +

    +

    2

    2

    1log

    1log

    pA

    n

    c

    p 1.0

    2

    101 =

    +

    110 1.0

    2

    =

    pA

    n

    c

    p

    sA

    n

    c

    s 1.0

    2

    101 =

    +

    110

    1.0

    2

    =

    pA

    n

    c

    s

    110

    1101.0

    1.0

    =s

    p

    A

    A

    s

    p

    s

    p

    A

    A

    s

    p

    A

    A

    s

    p

    s

    p

    n

    log

    110

    110log

    log

    110

    110log

    2

    1

    2

    1

    1.0

    1.0

    1.0

    1.0

    =

    =

    Notations:

    s

    p

    s

    p

    s

    p

    f

    f

    f

    fk ===

    2

    2

  • 8/9/2019 Curs DSP Complet

    42/123

    Given :dBA

    dBA

    s

    p

    20

    1

    =

    =

    kHzf

    kHzf

    s

    p

    5

    1

    =

    =, find : H(s)=?

    Solution :

    110

    110

    110

    110

    2.010*5

    10*1

    20*1.0

    1*1.0

    1.0

    1.0

    3

    3

    =

    =

    ===

    s

    p

    A

    A

    s

    p

    d

    f

    fk

    2

    10*6099.1

    =d

    == 565.2log

    log

    k

    dn choose n=3

    Poles:

    2

    12cos

    2

    12sin

    n

    kj

    n

    ksk

    +

    = ; 5,0=k

    Impose the stability condition for H(s)

    k=1,2,3n Chebyshev polynomials ( )nC

    0 1

    1

    2 12 2 3 34 3 4 188 24 + 5 52016 35 +6 1184832 246 ++

    7 75611264 357 +8 132160256128 2468 ++

    2. CHEBYSHEV FILTERS

    Chebyshev polynomials

    ( ) ( )( )

    >=

    1;c o s hc o s h

    10;c o sc o s1

    1

    n

    nCn

    1cos =u( ) nuCn cos=

    Figura grafic

    Figura graphic cosh x

  • 8/9/2019 Curs DSP Complet

    43/123

    n=0 : ( ) 10cos0 ==Cn=1 : ( ) ( ) === 11 coscoscosuCn=2 : ( ) 121coscos21cos22cos 21222 ==== uuCn=3 : ( ) ( )[ ] ( )[ ] 34cos3coscos4cos3cos43cos 313133 ==== osuuuC

    ( ) ( )[ ]( )( ) ( )[ ]( ) ( ) ( ) uCunuCC

    unuunuunC

    nuC

    unuunuunC

    nnn

    n

    n

    n

    coscoscos2

    sinsincoscos1cos

    cos

    sinsincoscos1cos

    11

    1

    1

    ==+=+=

    =+==

    +

    +

    Recursive formula for Chebyshev polynomials:( ) ( ) ( ) 11 2 + = nnn CCC ; n=1,2,3;

    ( )( )

    ==

    1

    0 1

    C

    C

    Properties of ( )nC :1) ( ) 10;10 nC ; ( ) 1;1 >> nC 2) ( )nC increases monotonically for 1>3) ( )nC is: -even polynomial for n-even

    -odd polynomial for n-odd

    4) ( )0C =

    e vn

    o dn

    ,1

    ,0

    ( )( )

    22

    2

    1

    1

    nCH

    += squared magnitude transfer function

    Properties:

    1) n the zeros of ( )nC are located in the interval 1 2) -for ( ) ( )

    21;1 HCn oscillates about unity such that the maximum

    value is 1 and minimum value is 21

    1

    +-for ( ) nC;1> increases rapidly,as becomes large , then ( ) 2H

    approaches zero rapidly.

  • 8/9/2019 Curs DSP Complet

    44/123

    Figura grafic

    n- even

    Figura grafic

    n-odd

    -for ( ) 1,1 1 == C for all n ( ) 2

    2

    1

    11

    +=H

    -for ( ) ( )

    22

    2

    1

    11

    n

    n

    C

    H

    +=

    ==>==

    S=j

    2

    12)(cos 1

    n

    kjs

    j

    s ==>=

    2

    12cos

    2

    12cos

    n

    kjs

    n

    kjs kk

    ==>

    =

    )(

    11

    )(1

    11

    )(1

    )(

    )(222222

    22

    r

    n

    r

    n

    r

    n

    r

    nr

    CCC

    C

    H ++

    =+

    =

    2

    )(log10)(

    rHA = [dB]

    +=)(

    11log10)(

    22

    r

    nC

    A [dB]

    +=)(

    11log10)(

    22

    p

    rn

    p

    C

    A

    [dB]

  • 8/9/2019 Curs DSP Complet

    51/123

    )1

    1log(10

    )(

    11log10)(

    222

    +=

    +=

    r

    r

    n

    r

    C

    A [dB]

    110

    1

    1.0 =

    rA

    E

    k

    dn1cosh

    1cosh

    1

    1

    Elliptic filters

    For LPF only)(1

    1)(

    22

    2

    RH

    += where R()-Tchebyshev rational functions.

    The roots of R () are related to the Jacobi elliptic sine function.

    Properties of R ():

    1) R() are even functions for even n and odd for odd n;

    2) Zeros of R() are in the range 1 ;3) R() oscillates between values -1 and +1 in PB;

    4) R()=1 for =1;

    5) R() oscillates between d+ and in the SB (d= discriminator factor)

    6)

    =

    =

    =

    2

    1

    122

    22

    2

    1

    022

    22

    ,1

    ,1

    )(n

    i i

    i

    n

    i i

    i

    e v en

    o dn

    R

    Normalized to center: frequency 10 =

    7) )(

    1)

    1(

    RR =

    The poles and zeros of R() are reciprocal and exhibit geometric symmetry

    .center frequency 0.

    1) 110)1log(10 1.02 ==>+= AppA

    2)110

    )1log(101.02

    2

    == >+=

    rAr d

    dA ;

    r

    pk

    = ; rp =0

    3)

    ( ) 41

    2

    4

    1

    2

    0

    11

    )1(1

    2

    1

    k

    kq

    +

    =

  • 8/9/2019 Curs DSP Complet

    52/123

    4)13

    00

    5

    00150152 qqqqq +++=

    5)

    q

    dn1

    log

    10log

    2

    =

    6)

    =

    =

    +

    +

    +=

    1

    0

    )1(

    1

    2cosh)1(21

    )12sinh()1(2

    2

    m

    mm

    m

    mmmn

    mq

    mqq

    a

    11

    11ln

    2

    1

    2

    2

    ++=

    n

    7)

    =

    =

    +

    +

    +

    =

    1

    0

    )1(

    1

    2cos)1(21

    12sin)1(2

    2

    m

    mm

    m

    mmmn

    l

    l

    n

    mq

    ln

    mqq

    il

    il

    =

    =2

    1

    oddnn

    i

    evennn

    i

    =

    =

    ,2

    1,1

    ,2

    ,1

    8) )1()1(V2

    2

    ik

    k ii

    =

    9) 21

    i

    ia

    =

    10) 221

    2

    i

    ii

    ia

    vab

    +=

    11) )1)(1(2

    2

    k

    akaU ++=

    12) 222

    22

    )1(

    )()(

    i

    ii

    i a

    UaVc

    +

    +=

  • 8/9/2019 Curs DSP Complet

    53/123

    13)

    +

    =

    =

    =

    2

    1

    12

    2

    1

    1

    0

    ,1

    1

    ,

    n

    i i

    i

    n

    i i

    i

    e v ena

    c

    o d dna

    ca

    H

    14)

    ++

    +

    +

    ++

    +

    =

    =

    =

    2

    12

    2

    0

    2

    12

    2

    0

    ,

    ,

    n

    i ii

    i

    n

    i ii

    i

    s

    o dncsbs

    as

    as

    H

    e v encsbs

    asH

    H

    Example: Design a filter with no more than 2 dB ripple in the PB up to an edge

    frequency of 3000 Hz. The filter is to attenuate the out of hand signals beyond

    4000 Hz by at least 60 Hz.

    Find H(s).

    dBAp 2 13000*22 == radsfpp

    dBAr 60

    14000*22

    == radsfrr

    75.0===r

    p

    r

    p

    f

    fk

    ( ) 41.0

    1.0

    10*6478.7

    110

    110 =

    =

    r

    p

    A

    A

    d

    4

    1

    2

    4

    1

    2

    0

    )1(1

    )1(1

    2

    1

    k

    kq

    +

    = ; 130

    9

    000 15052 qqqqq +++=

  • 8/9/2019 Curs DSP Complet

    54/123

    7.51log

    16log

    2

    =

    q

    dn . We choose n=6.

    1555.1

    1 == radsk

    r

    1

    0 3464*2== radsrp

    RsH 410*1374.7)( =

    )7341.005386.0)(194425.0)(10903.035518.0(

    )3955.1)(2153.2)(8451.13(222

    222

    ++++++++

    =sssss

    sssR

    Bessel Filters

    a))(

    1)(

    sBsH

    n

    =

    ==

    n

    k kkn

    sasB0

    )(, n-th order Bessel ..

    )!(!2

    )!2(

    knk

    kna

    knk =

    b) )()()12()( 22

    1 sBssBnsB nnn += with initial conditions ;1)0( =nB 1)1( +=sBn

    Frequency transformations for analog filters

    Type oftransformation

    Transformation Band edge frequenciesof new filter

    LPFss

    p

    p

    1

    HPF

    ss

    pp 1

    SBF

    lu

    lu

    ps

    ss

    +

    2

    )(

    PBF

    )(

    2

    lu

    lu

    ps

    s

    s

    +

    Transform Analysis of LTI Systems

    In time domain

  • 8/9/2019 Curs DSP Complet

    55/123

    0cT Tc

    1

    H(e )j

    h(n) impulse response of LTI for )()( nnx =

    y(n)=h(n)*x(n)=

    =

    k

    knxkh )()(

    Z transform)(arg)( jeH=

    D.F.T.

    )(*)()(

    jjjez eXeHeYj

    = =

    )(*)()(

    )()(

    jj

    j

    jj eeH

    eX

    eYeH == , where )(arg)( jeH= - phase

    We define arg )( jeH has principal value of phase: )(arg jeH

    )( > ZrreArgHeH jj += )(),(2)()(

    = )()(

    jeArgH

    d

    dtime delay except pants,

    where Arg )( jeH has discontinuities.

    a) A linear phase a low-pass filter

  • 8/9/2019 Curs DSP Complet

    56/123

    id

    nd n

    n

    n

    j

    ee

    ne

    jnnde

    nnh c

    jnjnjnjn

    LPF

    c

    c

    c

    c

    sin

    2

    11

    2

    1

    2

    1)( ====

    Comment: If n increases 0 LPFh , but not fast enoughb) Phase shift

    d

    j

    i d

    j

    i d

    j

    i dnjj

    i d

    di d

    n

    d

    eHd

    neH

    eHeeH

    nnh

    d

    =

    =

    =

    =

    =

    )4()3(

    )5()2(

    )6()1(

    )7()0(

    hh

    hh

    hh

    hh

    H(z) = h(0) (1 + h-7) + h(1) (z-1 + z-6) + h(2) (z-2 + z-5)+ h(3) (z-3 + z-4) =

    = z 27

    [h(0) (z 27

    + z 27

    ) + h(1) (z 25

    + z 25

    ) + h(2) (z 23

    + z 23

    ) h(3) (z 21

    + z 21

    )]

    H(ej) = H(z)|z=ej

    = e 27

    j [h(0) 2cos2

    7 + h(1) 2cos

    2

    5+ h(2) 2cos

    2

    3+ h(3) 2cos

    2

    ]

    =

    = e 27j H

    ~ () ej = H~

    7 () e

    +

    2

    7j

    = 0 | H~ 7 (ej)| 0 = |H(ej)| < 0

  • 8/9/2019 Curs DSP Complet

    71/123

    H~

    7 () = 2h(0) cos2

    7 + 2h(1) 2cos

    2

    5 + 2h(2) cos

    2

    3 + 2h(3) 2cos

    2

    1

    =

    +=

    2

    72

    7

    g r d

    H(ej) = e

    +

    2

    Nj H

    ~ ()

    H~ () = 2

    +

    =

    +2

    1

    1 2

    1

    N

    n

    nN cos

    2

    1n

    In general:

    -

    =

    =

    2

    2

    Ng r d

    N

    Antisymmetric impulse response with odd length (type 3)

    forN = even h(n) = -h(N-n)

    N=8 H(z) = =

    8

    0

    )(n

    nh .z-n = h(0).z0 + h(1).z-1 + h(2).z-2 + h(3).z-3 + h(4).z-4 +

    + h(5).z-5 + h(6).z-6 + h(7).z-7 + h(8).z-8

    h(n)= - h(8-n) = >

    == >=

    =

    ==

    =

    0)4()4()4(

    )5()3(

    )6()2()7()1(

    )8()0(

    hhh

    hh

    hhhh

    hh

    H(z) = h(0) (1+z-8) + h(1) (z-1 - z-7) + h(2) (z-2 - z-6) + h(3) (z-3 - z-5) =

  • 8/9/2019 Curs DSP Complet

    72/123

    = z-4 [h(0) (z4 - z-4) + h(1) (z3 - z-3) + h(2) (z2 - z-2) + h(3) (z1 - z-1)]

    z = ej zm + z-m = ejm- e-jm = 2jsin m

    H(ej) = H(z)|z= ej=

    = e-4j[h(0) 2jsin 4 + h(1) 2jsin 3 + h(2) 2jsin 2 + h(3) 2jsin] == e

    +

    24

    j [h(0) 2sin4 + + h(3) sin= e

    +

    24

    j H

    ~ () ej

    = 0 H~ () 0 = H~ () < 0

    ),0(

    ==

    ++=

    4

    24

    d

    dg r d

    In general:

    - H(ej) = e

    ++

    22

    Nj H

    ~ ()

    - H~ () = 2

    =

    2

    1 2

    N

    n

    nN sin n

    Antisymmetric impulse response with even length (type 4)

    forN = odd

    h(n) = -h(N-n)

    N=7 H(z) ==

    7

    0

    )(n

    nh z-n = h(0) + h(1) z-1 + h(2) z-2 + h(3) z-3 + h(4) z-4 +

    + h(5) z-5 + h(6) z-6 + h(7) z-7

    h(n)= -h(7-n) =>

    =

    =

    =

    =

    )4()3(

    )5()2(

    )6()1(

    )7()0(

    hh

    hh

    hh

    hh

    H(z) = h(0) (1 - h-7) + h(1) (z-1 - z-6) + h(2) (z-2 - z-5)+ h(3) (z-3 - z-4) =

  • 8/9/2019 Curs DSP Complet

    73/123

    = z 27

    [h(0) (z 27

    - z 27

    ) + h(1) (z 25

    - z 25

    ) + h(2) (z 23

    - z 23

    ) h(3) (z 21

    - z 21

    )]

    H(ej) = H(z)|z=ej = e 2

    7j [h(0)( e 2

    7j - e 2

    7j ) + h(1)( e 2

    5j - e 2

    5j ) + h(2) ( e 2

    3j

    - e 23

    j ) + h(3) ( e 21

    j - e 21

    j )] =

    = 2j e 27

    j [h(0) 2sin2

    7 + h(1) 2sin

    2

    5 + h(2) 2sin

    2

    3 + h(3) 2sin

    2

    1] = =e

    ++

    22

    7j H

    ~ ()

    H~

    () = 2[h(0) sin2

    7+ h(1) sin

    2

    5 + h(2) sin

    2

    3 + h(3) sin

    2

    1

    =

    +=

    2

    722

    7

    g r d

    = 0 H~ () 0 = H~ () < 0In general

    - H(ej) = e

    ++

    22

    Nj H

    ~ ()

    - H~ () = 2

    +

    =

    +21

    1 2

    1

    N

    n

    nN sin

    2

    1n ;

    =

    ++=

    2

    22

    Ng r d

    N

    General form of frequency response

    H(e

    j

    ) = e 2N

    j

    e

    j

    H~

    ()

  • 8/9/2019 Curs DSP Complet

    74/123

    () =

    z = 1

    is also zero of H(z)

    If z = ej (complex number on a unit circle) => z = e-j is also a zero of H(z)

    If z = rej is a zero of H(z) => z =je

    r

    1

    is also a zero of H(z)

    If zero at z = 1 is its own reciprocal, implying it can appear only single

    A type 2 FIR filter must have a zero at z = -1, since H(-1) = (-1)N |H(-1)| = -H(-

    1)

    For type 3 and 4 FIR filter H(-1) = -(-1)N H(-1) = -H(-1) forcing H(-1) = 0

  • 8/9/2019 Curs DSP Complet

    75/123

    Bounded real transfer function of FIR filter

    H(ej) =)(

    )(

    j

    j

    eX

    eY; |H(ej) | 1 - bounded real transfer function for causal filter

    (BR)

    |Y(ej)|2 |X(ej)|2 => y(n)2 x(n)2

    y(n) = x(n) - lossless transmitting signal

    Law Pass Digital Filter Design

    Eg: The moving average filter

    Ho(z) = ( )z

    zz

    1

    2

    11

    2

    1 1 +=+

    =

    =

    p oz

    z ez

    p

    z

    0

    1

    Z = ej

    H(ej) = H(z)|z = ej

    =

    j

    j

    e

    e 1

    2

    1 +

    Zz = -1 => z =

    Zz = 0 => p = 0 ( ),0( )

    H(ej) =

    2

    cos

    2

    12

    222

    j

    j

    jjj

    e

    e

    eee

    =

    +

  • 8/9/2019 Curs DSP Complet

    76/123

    =

    =

    =

    2c o s)(

    2

    1

    2

    1

    jeH

    g r d

    2

    1)(2 =CjeH

    20 log )( Cj

    eH

    = 20 log2

    1H( )0

    je = -20 log 2 = 3dB

    )( Cj

    eH

    =2

    1= cos

    2c

    => cos2

    cos4

    c = => c =2

    High Pass Filter

    LPF zz HPF

    =

    =

    0

    1

    p

    z

    z

    z

    H1(z) = ( ) zz

    zz

    1

    2

    111

    2

    1)(1

    2

    1 1 =

    =+

    H1(ej) =

    2sin

    2

    11

    2

    1 22

    222

    =

    =

    +

    j

    j

    jjj

    j

    j

    ee

    eee

    e

    e

    Filter design steps

    == >=

    == >=

    001

    zp

    zz

    zz

  • 8/9/2019 Curs DSP Complet

    77/123

    1. Specification of the filter requirementsa) signal characteristics

    - type of signal source

    - input output interface

    - data rates and width- highest of frequency

    b) characteristics of filter

    b1) desired amplitude

    } and their tolerances

    b2) phase response

    b1) desired amplitude is specific in frequency domain in tolerance scheme for

    selective filters

    b2) phase response - are used in equalize or compensate in phase response

    - speed of operation

    - modes of filtering in real time and not in real time

    c) level of implementation

    - high level language routines in a computer

    - DSP processor based system

    - choice of signal processor

    - costs

    2. Coefficients computation for FIR filters- random method

    - frequency sampling method

    - optimal method

    Computation of coefficients for IIR filters

    - impulse invariant method

    - bilinear method

    - pole zero placement method

    3. -- Representation of the filter by a suitable structure (realization)4. -- Analysis of the effect of finite word length in filter tolerance

    5. -- Implementation of filter in software and hardware mode

    IIR Filters

  • 8/9/2019 Curs DSP Complet

    78/123

    1) y(n) =

    =

    0

    )()(k

    knxnh

    2) y(n) = ==

    +N

    k

    N

    k

    k knynhknxa00

    )()()(

    3) H(z) =k

    N

    k

    k

    N

    k

    k

    k

    zb

    za

    =

    =

    +0

    0

    1

    Reconstruction of a bandwidth signal from its samples.

    Reconstruction scheme of a signal from its sampling signal

  • 8/9/2019 Curs DSP Complet

    79/123

    =

    =n

    nTtnxtx )()()(*

    =

    =

    =

    ===

    00 0

    00

    ~

    )()()()()(

    )()()()(*)()(

    mm

    T

    mTxmTthdmTttxh

    dttxhdtxhty

    omTnTh = )( for mn

    n

    n m

    n

    on

    zmTxmTnThznTyzy

    =

    =

    = ==

    0 0

    ~

    )()()()(*

  • 8/9/2019 Curs DSP Complet

    80/123

    )(*)(*

    )()()()()(*00

    )(

    0 0

    zXzH

    zmTxzkThzmTxkThzy m

    m

    k

    k

    mk

    n m

    =

    ===

    =

    =

    +

    =

    =

    IIR filter design by impulse invariant method.

    )()( ded nThTnh = , eh - impulse response of continuous. in time filterh(n) impulse of digital filter

    =

    +

    =k

    kTT

    j

    c

    j ddeHeH )()()

    2(

    Frequency for continuous time filter is noted by .

    Frequency for digital filter is noted by .Transfer function for CTF in band limited dT=

    =

    =

    ) ,()(

    ,0)(

    dTj

    c

    j

    d

    c

    eHeH

    TjH

    =

    =N

    k

    z

    k

    kc

    ss

    AsH

    1

    )( zT

    s ln1

    =

    1L

  • 8/9/2019 Curs DSP Complet

    81/123

    system fct of a digital IIR filter)(sHa - transfer fct. Of an analog filter

    This approximation is valid only in LPF or BPF ( low frequency filter ) and cannot

    be used for high frequency.

    ==

    +=

    L

    k

    k

    nTt T

    kTnTykTnTya

    dt

    dy

    1

    )()(

    Z

    =

    =L

    k

    Kk

    k ZZaT

    s1

    )(1

    jeZ=

    ( ) = =

    ==L

    k

    L

    k

    k

    kjkj

    k kaT

    jeeaT

    s1 1

    sin21

    =

    ==L

    k

    k kaT

    js1

    sin2

    Is difficult to calculate { }ka for the poles that are inside the unit circle.

    Ex 1:

    Convert the analogue band pass filter with system function9)1.0(

    1)(

    2

    ++=

    s

    sHa into

    a IIR digital filter by use of the backward difference for derivative.

  • 8/9/2019 Curs DSP Complet

    89/123

    21

    2

    2

    2

    21

    1

    01.92.01

    1

    01.92.01

    )1.01(21

    01.92.01

    91.01

    1)()( 1

    =

    +++

    +++

    ++=

    =

    +

    +

    ==

    ZTT

    ZTT

    T

    TT

    T

    T

    ZsHZH

    T

    Zsa

    Choose T=0.1 =>5.16

    2,1 949.0jep =

    Ex2:

    Convert the analogue band pass filter with9)1.0(

    1)(

    2 ++=

    ssHa into a digital IIR filter by the

    use of the mapping ( )11 = zzT

    s

    ( ) 12.0)01.92(2.0......

    91.01

    1)(

    2234

    22

    2

    1++++

    ==

    +

    +

    = TzzTTzz

    TZ

    zzT

    zH

    Bilinear transform

    +

    =

    1

    1

    1

    12

    z

    z

    T

    s

    =

    +=

    jr eZ

    js

    ++

    +++

    =

    +=

    cos21

    sin2

    cos21

    12

    1

    1222

    2

    1

    1

    rr

    rj

    rr

    r

    Ter

    er

    Ts

    j

    j

    =>

    cos21

    12

    2

    rrr++

    =

    cos21

    sin22

    rr

    r

    ++=

  • 8/9/2019 Curs DSP Complet

    90/123

    If r

    r=1 0= => =js ,2

    tan2

    )cos1(2

    sin22

    TdTd=

    +=

    -the transformation is not bijective; is non linear.

    Ex: Convert the analogue filter with the system fct.16)1.0(

    1.0)(

    2 +++

    =s

    ssHa into a

    digital IIR filter by means of the bilinear transformation. The digital filter is to have

    a resonant frequency:2

    =r

    4=r 2

    =r

    2

    1

    2tan

    2 == TdrTd

    r

    1

    1

    1

    14

    +

    =Z

    Zs

    21

    21

    2

    1

    1

    1

    1

    1

    14

    975.00006.01

    122.0006.0128.0

    161.01

    14

    1.01

    14

    )()(1

    1

    +

    =

    +++

    =

    =

    +

    +

    +

    ++

    ==

    zz

    zz

    z

    z

    z

    z

    sHzHz

    zsa

    poles:2

    2,1

    2

    987.0

    0975.01

    +=

    =+

    j

    ez

    z

    095.101222.0006.0128.0 2,121 ==+ zzzzzeros

    Usually, the design begins with the digital filter specifications, after that consider the

    analogue filter which satisfies the imposed specifications.

    Ex 1: Design a single pole low-pass filter with 3dBbandwidth of 0.2 using thebilinear transformation applied to the analogue filter.

    c

    c

    ssH

    +

    =)( , where c is the

    3dB bandwidth of analogue filter.

    c=0.2

  • 8/9/2019 Curs DSP Complet

    91/123

    c= Td2

    tan2

    c=T

    2tan

    2

    0.2=

    Td

    65.0

    Then the transfer function will be: H(s)=

    T d

    T d

    s 6 5.0

    6 5.0

    +

    H(z)=H(s)|s= Td2

    (

    1

    1

    1

    1

    +

    z

    z

    )=Tdz

    zTd

    Td

    65.0

    1

    12

    65.0

    )( 11 +

    +

    =1

    1

    509.01

    )1(245.0

    +

    z

    z

    Z=ej

    H(ej

    )= j509.01

    )1(245.0

    +

    e

    e jw

    =0 H(ej )=509.01

    490.0

    1

    c=0.2 H(ej0.2

    ) = 707.0

    509.01

    )1(245.0j0.2-

    -j0.2

    =

    +

    e

    e 3 dB attenuation

    Ex. 2:

    The specifications on the discrete-time filter are:

    0.819125 |H( -j0.2e ) 1; 0 0.2| H( -j0.2e )| 0.17783; 0.3

    For this specific filter, the analogue filter must have:

    0.89125 | Hc( -je

    )| 1; 0 Td

    2tan

    2

    0.2

    | H( -je )| 0.17783;Td

    2tan

    2

    0.2

    Td

    2tan2

    ()

    For convenience choose Td=1{ (| Hc 2jtan0.1e )|0.89125{ (| Hc j2tan0.15e )| 0.17783

    |Hc(ej

    )|2= Nc

    2)(1

    1

    + Butterworth filter

    1+(c1.0tan2

    )2N=89125.0

    1

    1+( c

    15.0tan2

    )

    2N

    = 17783.0

    1

    N=5.30466

    Choose N=6 c=0.76622

    We take the functions from the tabels for various degrees. We choose the poles

    from the left in order to have stability.

  • 8/9/2019 Curs DSP Complet

    92/123

    Hc(s)= )5781.0480.1)(5871.00836.1)(5871.03966.0(20238.0

    222 ++++++ ssssssH(z)=

    )2155.09044.01)(3583.00106.11)(7051.02686.11(

    )1(0007378.0212121

    1

    ++++

    zzzzzz

    z

    Draw the signal flow-graph of implementation of the system:-as a cascade of 2nd order section

    -in direct form I and direct form II

    -in the parallel form using 2nd order section

    IIR filters Form

    Y(n)==

    N

    k

    k knxa0

    )( +=

    N

    k

    x knyb1

    )( (1)

    Or

    H(z)=

    =

    =

    +N

    k

    k

    k

    N

    ok

    kk

    zb

    za

    1

    1

    (2)

    or

    H(z)=))...()((

    )(...))((

    21

    21

    n

    n

    pzpzpz

    zzzzzzk

    (3)

    Pole-zero placement method:

    Ex.1: A bandpass filter is required to meet the following specifications:

    -a complete rejection on d.c. and 250 Hz

    -a narrow band centered at 125 Hz

    -a 3 dB bandwidth of 10 Hz

    Assuming a Fs=500Hz, obtain the transfer function of the filter by suitable placing

    z-plane poles and zeros and its diference equation. Sketch the block-diagram of the

    filter.

    0o complete rejection

    oo

    180

    500

    250*360=

    Passband must be centered at 125 Hz and we must have the poles

    oo

    90500

    125*360=

    r=1- 500

    10=0.937

  • 8/9/2019 Curs DSP Complet

    93/123

    H(z)= 2

    2

    2

    2

    077969.01

    1

    877969.0

    1

    )937.0)(937.0(

    )1)(1(

    22

    +

    =+

    =

    +z

    z

    z

    z

    ezez

    zz

    jj

    y(n)=-0.877969y(n-2)+x(n)+x(n-2) the form we need

    In this form the coefficients are:a0=1 ;a1=0; a2=-1;

    b1=1; b2=0.877969.

    Ex.2: A digital notch filter has the following specifications:

    -notch frequency: 50 Hz (notch = cutting, very sharp stop-band)

    -3 dB width of the notch: +/- 5Hz

    -sampling frequency: Fs=500 Hz

    To reject the comp. of 50 Hz we place a pair of zeroes at points in the corresponding

    unit circle.o

    o

    36500

    50*360=

    -for poles: r=1- 937.0500

    51 ==

    Fs

    bw

    H(z)=

    21

    11

    2

    2

    3636

    3636

    87.0516.11

    618.11

    87.05161.1

    1618.1

    )937.0)(937.0(

    ))((

    ++

    =

    =+

    +=

    zz

    zz

    zz

    zz

    ezez

    ezezoo

    oo

    jj

    jj

    The differential equations for this filter:

    The E of this notch filter is:

    y(n)=x(n)-1.618x(n-1)+x(n-2)+516y(n-1)-0.878y(n-2)

    In the coefficient form:

    a0=1; a1=-1.618; a2=1;

    b1=-1.5161; b2=0.878

    Measure of information

    X- space of discrete random variables with possible outcomes ix , ni ,1=

    Y- space of discrete RV with possible outcomes jy , mj ,1=

  • 8/9/2019 Curs DSP Complet

    94/123

    - If X,Y are statistically independent, then the measure of information they will

    define should be zero (no information)

    - If X,Y are mutual dependent (causal link), then the measure of information they

    will define should be given by ixx = , when jyy = .

    Postulates:

    1) 0)( ixP (probability of event ix )

    2) 1)( =XP (probability of the sample space X (certain event))

    3) = ji yx , ,...2,1= ji

    -these are called mutually exclusive events

    ==

    =n

    i

    iii

    xPxPU11

    )()( - probability of the mutually exclusive events

    Joint events and joint probability

    Theorem:

    If one experiment has the possible outcomes ix , ni ,1= and the second experiment

    has the possible outcomes mjyj ,1, = , then the combined experiment has the

    possible outcomes ),( ji yx , ni ,1= , mj ,1=The joint probability:

    ),( ii yxP of combined experiment satisfies the condition: 1),(0 ji yxP

    Theorem:

    If the outcomes jy ; mj ,1= are mutually exclusive, then =

    =m

    j

    iji xPyxP1

    )(),(

    Similarly, if the outcomes nixi ,1, = are mutually exclusive events, then

    = =n

    i

    jji yPyxP1

    )(),(

    If all the outcomes of the 2 experiments are mutually exclusive, then :

    = =

    =n

    i

    m

    j

    ji yxP1 1

    1),(

  • 8/9/2019 Curs DSP Complet

    95/123

    Conditional probabilities

    )(

    ),()|(

    j

    ji

    jiyP

    yxPyxP = ; 0)( >jyP - conditional probability of the event ix given by

    the accuracy of the event jy

    )(

    ),()|(

    i

    ji

    ijxP

    yxPxyP = , )|()()|()(),(0)( ijijijjii xyPxPyxPyPyxPxP ==>

    Notes

    1. If ji yx ( ji yx & are mutually exclusive events) then 0)|( =ji yxP

    2. If ix is a subset of jy ( iji xyx = ) then)(

    )()|(

    j

    i

    jiyP

    xPyxP =

    3. If jy is a subset of ix ( jji yyx = ) then 1

    )(

    )()|( ==

    j

    j

    ji

    yP

    yPyxP

    Bayes Theorem

    If nixi ,1; = are mutually exclusive events such that ni

    i Xx1=

    = and Y is an arbitrary

    event with 0)( >YP , then =

    ==

    n

    j

    jj

    iii

    i

    xPxYP

    xPxYP

    YP

    YxPYxP

    1

    )()/(

    )()/(

    )(

    ),()|(

    Statistical independence

    If the occurrence of X doesnt depend on the occurrence of Y, then )()|( XPYXP =

    and )()(),( YPXPYXP =

    Example:

    )()(),(

    )()(),(

    )()(),(

    3131

    3232

    2121

    xPxPxxP

    xPxPxxP

    xPxPxxP

    ===

    Logarithmic measure of information

    ==)()(

    ),(log)(

    )/(log),(ji

    ji

    b

    i

    ji

    bjiyPxP

    yxPxP

    yxPyxI mutual information ji yx ,

    if b=2 then:

    - ),( ji yxI [bits]

    if b=e then: b=e [nats]

  • 8/9/2019 Curs DSP Complet

    96/123

    a

    aae

    ln44265.1log

    log69315.0log

    2

    2=

    Observations

    1. If the random variables X & Y are statistically independent, then )()|( iji xPyxP = ,

    then 0),( =ii yxI

    2. If the random variable are fully dependent, then

    ==== )()(log)(

    1log),( iib

    i

    bji xIxPxP

    yxI self information.

    Show that:

    )()(

    ),(log

    )(

    )/(log),(

    ji

    ji

    b

    i

    ji

    bjiyPxP

    yxP

    xP

    yxPyxI

    ==

    )(log)( ibi xPxI =

    Since:

    ),();(

    )(

    )/(

    )()(

    ),(

    )()(

    )()/(

    )(

    )/(

    ijji

    j

    ij

    ji

    ji

    ji

    jji

    i

    ji

    xyIyxI

    yP

    xyP

    yPxP

    yxP

    yPxP

    yPyxP

    xP

    yxP

    =

    =

    =

    =

    Examples:1) Suppose a discrete information source that emits a binary digit }1,0{=ix with

    equal probability at every seconds. (2

    1)( =ixP ) then the information content

    of each output source is 12

    1log)(log)( 22 === ii xPxI [bit]

    2) If considered a block of K binary digits from the source, which occurs in a

    time interval K then KixP2

    1)( = then Kxi Ki ==

    2

    1log)(

    2 [bits]

    X- the set of signals on entry point

    Y- the set of signals on exit point

  • 8/9/2019 Curs DSP Complet

    97/123

    X & Y {0,1}

    0P - Probability of error for input 0

    1P - Probability of error for input 1

    ======

    0

    0

    )0/1(

    1)0/0(

    PXYP

    PXYP

    ======

    1

    1

    )1/0(

    1)1/1(

    PXYP

    PXYP

    )1(2

    1

    2

    1

    2

    1)1(

    )1()1/0()0()0/0()0(

    101 PPPP

    XPXYPXPXYPYP

    o +=+=

    ====+=====

    )1(2

    1

    2

    1)1(

    2

    1

    )1()1/1()0()0/1()1(

    1010 PPPP

    XPXYPXPXYPYP

    +=+=

    ====+=====

    We know that = )(log)( ibi xPxI self information

    ==

    )()(

    ),(log

    )(

    )/(log),( 2

    ji

    ji

    b

    i

    ji

    iiyPxP

    yxP

    xP

    yxPyxI mutual information

    Then:

    )1(

    2

    1

    1log

    )0(

    )0/0(log)0,0(

    00

    0

    22

    PP

    P

    YP

    XYPI

    +

    =

    ===

    =[bits]

    Similarly:)1(

    2

    1

    1log

    )1(

    )1/1(log)1,1(

    01

    122

    PP

    P

    YP

    XYPI

    +

    =

    ===

    =

    Special Cases

    a) If

    +=+

    =

    +=+

    =

    ==

    )1(l o g11

    )1(2l o g)1,1(

    1)1(l o g)1(

    )1(2l o g)0,0(

    22

    22

    10

    PPP

    PI

    PPP

    PI

    PPP

    Cases:

    1: == 010 PP Errorless channel (without noise)

  • 8/9/2019 Curs DSP Complet

    98/123

    =

    =

    1)1,1(

    1)0,0(

    I

    Itotal information

    2: ==== 0)1,1()0,0(2

    110 IIPP dont transform information

    3: 587,0)1,1(3log1)0,0(4

    1210 ==+=== IIPP [bits]

    Conditional self information

    I(xi/yj)= logb ( )ji

    yxP /

    1= logbP(xi/yj) information about x= I after having

    observed the event Y= jy

    I(xi/yj)= I(xi)-I(xi/yj)

    0)y/x(I0I ( x i )ii

    I(xi/yj)>;0; average number of bits per symbol

    JxHRxH J

    1)()( +

  • 8/9/2019 Curs DSP Complet

    109/123

    9 5.02 1.21 1.2)(

    2 1.2)(

    1 1.2)(l o g)()(

    7

    1

    7

    1

    2

    ===

    ==

    ==

    =

    =

    RxH

    nxpR

    b i t sxpxpxH

    i

    ii

    i

    ii

    Code II:

    H(x) = 2.11 bits ; R

    = 2.66 ; ..8.066.2

    11.2)(==

    R

    xHLetter p(xi) - log2p(xi) Code Length

    x1

    x2

    0.45

    0.35

    1.156

    1.52

    1

    0 1

    1

    2

  • 8/9/2019 Curs DSP Complet

    110/123

    x3 0.2 2.33 0 0 2

    9 7.0)(

    5 5.1)(

    5 1 8.1)(l o g)()(

    3

    1

    3

    1

    2

    ==

    ==

    ==

    =

    =

    R

    xH

    nxpR

    b i t sxpxpxH

    i

    ii

    i

    ii

    Letter pair p(xi ,yj) -log2p(xi, yj) Code Length ni

    x1 x1 0.2025 1 0 2x1 x2 0.1575 0 0 0 3

    x2 x1 0.1575 0 1 0 3

    x2 x2 0.1225 0 1 1 3

    x1 x3 0.09 1 1 0 3

    x3 x1 0.09 0 0 1 0 4

    x2 x3 0.07 0 0 1 1 4

    x3 x2 0.07 1 1 1 0 4

    x3 x3 0.04 1 1 1 1 4

    9.0)(

    /0 6 7.3

    0 3 6.3)(==

    =

    =

    R

    xH

    l e t t e r b i t sR

    b i t sxH

    Figure Code

    Or code II figure

  • 8/9/2019 Curs DSP Complet

    111/123

    %9

    )(

    /0 6 7.3

    0 3 6.3)(

    ==

    =

    =

    R

    xH

    l e t t e r b i t sR

    b i t sxH

    Coding for analog sources

    An analog source emits a waveform ( )tx that is a sample function of a stochasticprocess ( )tX .

    If ( )tX is a stationary stochastic process: autocorrelation function is ( )xx power density function is ( )fxx

    If ( )tX is a stationary stochastic process with band limited, then ( ) 0= fxx .For the signals above, we ca use the Sampling Theorem:

    ( )

    =

    +

    =

    s

    s

    s

    s

    n s

    f

    ntf

    f

    ntf

    f

    nXtX

    sin

    where: max2 ffs = -Nyquist criterionmax

    f -highest frequency of the signal

    sf -sampling frequency

    Type of encoding represent each sample (discrete amplitude level) by a

    sequence of binary digits. Hence for L levels the number of binary digits is:

  • 8/9/2019 Curs DSP Complet

    112/123

    R=[ ] k

    k

    forLL

    forLL

    21log

    2log

    2

    2

    +

    =

    If the levels are not equally probable and the probabilities of the output levels are

    known ,then we use the Huffman coding(entropy coding).

    If the levels are not equally probable and the probabilities are not known, we canestimate the encoding source.

    Quantization means both compression of data and distortion of the waveform (loss

    of signal fidelity).

    Minimization of the distortion can be made with PCM, DPCM and DM.

    PCM-Pulse Code Modulation

    ( )tx -a sample function emitted by the source

    ( )nx

    -samples taken at a sample ratemax2 ffs

    In PCM, each sample of the signal is quantized to one of R2 amplitude levels and

    the rate of source is sbitsfR s .

    nnn qxx +=~

    - mathematical model of quantization

    -nx

    ~-quantized value of nx

    - nq -noise

    Uniform Quantizer

    7 bit quantizerinput-output characteristic for a uniform quanitzer:

    pdf- probability density function

  • 8/9/2019 Curs DSP Complet

    113/123

    ( ) =1qp

    R= 2 - size of quantization

    MSE mean square error -2q

    ( ) ( )

    =

    =

    =

    == 2

    2

    222

    2

    3

    22

    2

    22

    12

    2

    123

    11R

    qdqqdqqqpq

    ( ) ( ) dBRRqqR

    8.10612log102log2012

    2log10log10

    2

    2log

    2 ====

    ex: for R=7bits,

    ( ) dBdBq 8.522 =

    uniform quantization non-uniform quantization

    An uniform quantizer provides the same spacing between successive levels

    throughout the entire dynamic range of a signal.

    A better approach is to have more closely spaced levels at the large signal amplitude=>non uniform quantizer.

    A classic non uniform quantizer is a logarithmic compressor (Javant 1974 for speech

    processing)

  • 8/9/2019 Curs DSP Complet

    114/123

    y - magnitude of output

    x - magnitude of input

    - compression factor

    ( ))1log(

    1log

    x

    xy

    +

    +=

    ex: =225; R=7 => ( ) dBq 772 =

    A non quantizer is made from a non-linear device that compresses the signal and a

    uniform quantizer.

    DPCM Differential Pulse Code Modulation

    In PCM each sample is encoded independently. However, most sources

    sampled at Nyquist rate or faster exhibit significant correlation between successivesamples (the average change is successive sample and is small).

    Exploiting the redundancy => lower rate for the output

    Simple solution encoding the differences between successive samples.

    Refinement: to predict the current sample based on previous p samples.

    =

    =p

    i

    inin xax1

    ^

    ;

    { }ia - coefficient of predictionn

    x - current sample^

    nx- predicted sample

    MSE for computation of { }ia coefficients:

  • 8/9/2019 Curs DSP Complet

    115/123

    ( )

    ( ) ( ) ( )

    =

    ==

    =

    +=

    =

    =

    ==

    p

    j

    jninji

    p

    i

    p

    i

    innin

    p

    i

    ninnnnp

    xxEaaxxEaxE

    xaxExxEeE

    111

    2

    2

    1

    2^

    2

    2

    The source is stationary with ( )n -autocorrelation function.If the source is wide sense stationary, results:

    ( ) ( ) ( )

    = = =+=

    p

    i

    p

    i

    p

    j

    jiip ijaaia1 1 1

    20

    Minimization of p with respect to predicted coefficients { }ia results in a set oflinear equations:

    ( ) ( )jjiap

    i

    i ==1

    ; j=1,2,,p Yule-Walker equations

    If ( )n is unknown apriory, it can be estimated by the relation:

    ( ) =

    +=N

    i

    niixxN

    n1

    ^ 1; n=0,1,2,,p

    nx - sampled value ne - predicted error~

    nx - quantized signal~

    ne - quantized predicted error

    ^~

    nx- predicted quantized signal nq - quantized error

    Encoder:

    Decoder:

  • 8/9/2019 Curs DSP Complet

    116/123

    =

    ==p

    i

    ininnnn xaxxxe1

    ~^~

    nnnnnnnnnnnxxxxexxeeeq =+=

    ==

    ~

    ^

    ~~

    ^

    ~~~

    The quantized value~

    nx differs from the input nx by the quantization error nq

    independent of the predictors prediction. Therefore the quantization errors do not

    accumulate.

    Improvement in the quality of estimation => inclusion of the linearly filtered past

    values of the quantized error.

    = =

    +=p

    i

    m

    i

    iniinin ebxax1 1

    ~~

    Encoder:

    Decoder

    figure

    Adaptive PCM and DPCM

    Many real sources are quasistationary. The variance and autocorrelation functions of

    the source output vary slowly with time. The PCM and DPCM encoders are

    figure

  • 8/9/2019 Curs DSP Complet

    117/123

    designed on the basis that the source output is stationary. The efficiency and

    performance can be improved by having them adapted to the slowly time-variant

    statistics of the source. The quantization error q n has a time-variant variance.

    Reducing of the dynamic range of q n by using an adaptive quantifier

    n+1 = n M(n), where :

    n is the step size of the quantizer for processingM(n) is the multiplication factor dependent of the quantizer level for the sample x(n)

    PCM DPCM

    2 3 4 2 3 4

    M(1) 0.60 0.83 0.8 0.8 0.9 0.9

    M(2) 2.20 1.00 0.8 1.6 0.9 0.9

    M(3) 1.00 0.8 1.25 0.9M(4) 1.50 0.8 1.70 0.9

    M(5) 1.20 1.20

    M(6) 1.60 1.60

    M(7) 2.00 2.00

    M(8) 2.40 2.40

    In DPCM the predictor can also be made adaptive when the source output is

    stationary. The predictor coefficients can be changed periodically to reflect the

    changing signal statistics of the source. The short-term estimate of the

    autocorrelation function of x n replaces the ensemble correlation function. Thepredictor coefficients are passed along the receiver with the quantization error en.

    The source predictor is implemented at the receiver and a higher bit rate results. The

    advantage of decreased bit rate produced by using a quantizer with fewer bits is lost.

    An alternative is the using of a predictor at the receiver that may compute its own

    predicted coefficients from en and xn .

    Delta Modulation (DM)Adaptive Delta Modulation (ADM)

    Delta Modulation is a simplified form of DPCM in which a 2-level (1 bit) quantizer

    is used in conjunction with a fixed first-order prediction.

  • 8/9/2019 Curs DSP Complet

    118/123

    x n = xn-1 en-1

    x n = x n-1 +q n-1 + x n-1 x n-1 = x n-1 + q n-1q n = en en = en (x n x n)

    The estimated value of x n is the previous sample x n-1 modified by the quantization

    noise q n-1. The difference equation represents an integrator with an input e n.

    An equivalent realization of the one-step predictor is an accumulator with an input

    equal to the quantized error e n

    In general the quantized error signal is scaled by some value, say 1, called stepsize.

    The encoder shown in the figure approximates the waveform x(t) by a linear

    staircase function (the waveform must change slowly relative to the sampling rate. Itresults that the sampling rate must be about 5 times greater or equal to the Nyquist

    rate.

    +

    Sampler _ Quantizer to transmitter

    xn= xn-1

    Encoder Unit delay + z-1

    en LPF output

    Decoder

    z-1

    ____________________________________________________________________

    ____________________________________________________________________

    + en = 1Sampler _ Quantizer to transmitter

  • 8/9/2019 Curs DSP Complet

    119/123

    Encoder xnAccumulator +

    1

    en+ Accumulator LPF output

    1 Decoder

    Joyant (1970)e n e n-1 n = n-1 K , K > 1

    en = 1Sampler Quantizer

    z-1

    Accumulator +

    Continuous variable slope:

    +=

    +=

    21

    11

    K

    K

    nn

    nn

    21

    ~;~;~ nnn eee have the same sign

    K1 >>K2 > 0 ; 0

  • 8/9/2019 Curs DSP Complet

    120/123

    Instead of sending the samples of the source waveform, the parameters of the linear

    system are transmitted along with the appropriate excitation signal.

    - The source output sampled at a rate > Nyquist rate

    { } 1,0 = Nnnx

    - The sample sequence is assumed to have been generated by an all-pole filter with:

    =

    =

    p

    k

    k

    kza

    GxH

    1

    1

    )(

    Excitation functions: - impulse- sequence of impulses

    - white noise with unit variance

    The difference equations for the filter

    = =

    +=p

    k

    p

    k

    knkknkn vbxaX1 1

    or

    =

    =+=p

    k

    nknkn NnGvxaX1

    ,0;

    In general, the observed source output does not satisfy the difference equation, only

    its model does.

    If the input is a white noise sequence or an impulse, we may for an estimate

    (prediction) of Xn :

    =

    >=p

    k

    knkn nxaX1

    0;

    The error of the observed value Xn with respect to the predict value nX is

    =

    ==p

    k

    knknnnnxaxxxe

    1

    The filter coefficients are chosen to minimize the mean square of the error

    = = =

    =

    +=

    ==

    p

    k

    p

    k

    p

    m

    mkkk

    p

    k

    knknnp

    mkaaa

    xaxEeE

    1 1 1

    2

    1

    2

    )(2)0(

    ])[()(

    where )(m is auto correlating function of sequence Xn.

  • 8/9/2019 Curs DSP Complet

    121/123

    p is identical to MSE for a predictor used in DPCM and results the Julle-Walker

    equations.

    To completely specify the filter H(z), the filter gain G has to be specified.

    p

    p

    k

    knknnn xaxEGvEGvGE ==== =

    ])(])[(]))([(2

    1

    2222

    where p is the residual MSE obtained after substituting the optimum predictioncoefficients (Julle-Walker equations).

    =

    ==p

    k

    kp kaG1

    2)()0(

    Usually the time auto correlation function of the source output is unknown, and we

    use the estimate

    =+ ==

    nN

    i

    nii NnxxN

    n1

    1,0;1

    )(

    Julle-Walker equation =>)()(

    ,1);()(1

    jbyreplacedjwith

    pjjjiap

    ki

    = ==

    Matriceal form of Julle-Walker equation:]]][ =a

    where)(]

    ]

    )(][

    ielementswithvectorcolumnR

    tscoefficienpredictorofvectorcolumnRa

    jielementswithR

    pxp

    pxp

    ji

    pxp

    =

    Example : p=4;

    )0()1()2()3(

    )1()0()1()2(

    )2()1()0()1(

    )3()2()1()0(

    = - Toeplitz matrix

    Recursive algorithm for the inverse Toeplitz matrix is done by Durbin and Levinson

    (1959):

    ) Start with 1st order predictor )0(0 =

    2)

  • 8/9/2019 Curs DSP Complet

    122/123

    )0()1(;

    ,1

    1,1;)1(

    )()(

    )1(

    ,1,1

    1

    1

    ,1

    ==

    =

    =

    =

    =

    =

    iikiiiikiik

    i

    k

    ki

    ij

    jiiji

    aaaaa

    pi

    iki

    kiai

    a

    a

    3)

    =

    ==

    ==p

    k

    kp

    kpk

    kaG

    pkaa

    1

    2

    ,

    )()0(

    ,1;

    The recursive solutions give the predictive coefficients for all orders less than p.

  • 8/9/2019 Curs DSP Complet

    123/123

    The residual MSE pii ,1; = form a monotone decreasing sequence:

    1

    ... 011