ders notları toplu

163
LECTURE NOTES ON DIGITAL SIGNAL PROCESSING Prof. Dr. A. Salim KAYHAN Hacettepe University Department of Electrical and Electronics Engineering ANKARA-2014

Upload: fikret

Post on 27-Sep-2015

339 views

Category:

Documents


5 download

TRANSCRIPT

  • LECTURE NOTES ON

    DIGITAL SIGNAL

    PROCESSING

    Prof. Dr. A. Salim KAYHAN

    Hacettepe University

    Department of Electrical and Electronics Engineering

    ANKARA-2014

  • ELE 407 Digital Signal Processing

    Fall 2014

    Place: E-? Time: Wednesday 13:00-15:50 Course Outline: W1-Sep.24 Review of Discrete-time signals, systems, Fourier, Z-tr. W2-Oct.01 Sampling, Decimation, Interpolation. W3-Oct.08 Frequency Response . W4-Oct.15 Relation Between Magnitude and Phase, Flow Graph

    Realization. W5-Oct.22 Flow Graph Realization of FIR sys., Quantization. W6-Oct.29 No Class. (Holiday) W7-Nov.05 EXAM W8-Nov.12 Butterworth and Chebyshev Filter Design. W9-Nov.19 Butterworth and Chebyshev Filter, FIR Filter Design. W10-Nov26 Discrete-time Fourier Series, DFT, Properties of DFT. W11-Dec03 Convolution with DFT (Overlap-add/save). FFT. W12-Dec10 Fast Fourier Transform(FFT). W13-Dec17 EXAM. W14-Dec24 2-D Signal Processing. Textbook: Discrete-time Signal Processing, Oppenheim and Schafer, Prentice-Hall. Grading: 2Term Exams (50%), Final Exam (50%).

  • 1Digital Signal Processing A.S.Kayhan

    DIGITAL SIGNAL

    PROCESSING

    Textbook: Discrete-Time Signal Processing, Oppenheim and Schafer, Prentice-Hall.

    Digital Signal Processing A.S.Kayhan

    Course Outline

    Review of Discrete-time signals, systems, Fourier tr.

    Review of Z-transform

    Sampling, Decimation, Interpolation

    Time and frequency response of systems

    Flow Graph Realization

    Filter Design

    Discrete-time Fourier Series, Discrete Fourier Transform

    Fast Fourier Transform

    2-D Signal Processing

  • 2Digital Signal Processing A.S.Kayhan

    SIGNALS:A signal is a function of time representing a physical variable, e.g. voltage, current, spring displacement, share market prices, number of students asleep in the class, cash in the bank account.

    Continuous time signals : x(t), x(t1,t2,...)Speech signals, Image signals,Video signals, Seismic signals, Biomedical signals (ECG,EEG,...)

    Discrete-time signals: x[n], x[n1,n2,...]Inherently discrete-time (Stock market)Discretized continuous-time(Most signals)

    Digital Signal Processing A.S.Kayhan

    SIGNALS:Deterministic or Random

  • 3Digital Signal Processing A.S.Kayhan

    Speech data (8kHz):

    Digital Signal Processing A.S.Kayhan

    Discrete-time signal example:Stock Market daily closing values

  • 4Digital Signal Processing A.S.Kayhan

    Annual max. temperature and precipitation for Ankara (data: MGM)

    Digital Signal Processing A.S.Kayhan

    Graphical Representation of Signals

    Continuous-timeSignal

    Discrete-timeSignal

  • 5Digital Signal Processing A.S.Kayhan

    Reflection: x[-n]

    Digital Signal Processing A.S.Kayhan

    Time-scaling: x(at)

    Time-scaling in discrete-time is not straightforward.Discussed in Decimation and Interpolation.

  • 6Digital Signal Processing A.S.Kayhan

    Time-shift: x[n-no]

    Digital Signal Processing A.S.Kayhan

    Basic Discrete-time Signals:Unit Step Function :

    0,1

    0,0][

    n

    nnu

  • 7Digital Signal Processing A.S.Kayhan

    Unit Impulse Function:

    0,1

    0,0][

    n

    nn

    n

    k

    knu

    nunun

    ][][

    ]1[][][

    ][]0[][][ nxnnx

    Digital Signal Processing A.S.Kayhan

    Real Exponential: nn aCeCnx ][

  • 8Digital Signal Processing A.S.Kayhan

    Complex Exponential: nj oeAnx ][Sinusoidal Signal: )cos(][ nAnx o

    }{][ )( nj oAenx Re

    Digital Signal Processing A.S.Kayhan

    Periodicity Properties:

    njnj oo ee )2(

    Therefore, consider only 20 o

    njNnj oo ee )(If periodic, then

    N

    m

    e Nj o

    2

    1

    0

    m and N integer.

  • 9Digital Signal Processing A.S.Kayhan

    If periodic with fundamental period N, then fundamental frequency is N/2

    If there are a few exponentials in the form:

    nN

    jk

    k enx2

    ][

    they are harmonically relatedThere are only N such distinct signals.

    Digital Signal Processing A.S.Kayhan

    SYSTEM:Any process that transforms signals

  • 10

    Digital Signal Processing A.S.Kayhan

    Digital Signal Processing A.S.Kayhan

    Interconnection of Systems:Series(Cascade), Parallel, Series/Parallel.

  • 11

    Digital Signal Processing A.S.Kayhan

    Properties:Memoryless if output depends only on input at the same time.

    Example: Discrete-time systems with memory:

    n

    k

    kxny ][][

    ]1[][ nxny

    Digital Signal Processing A.S.Kayhan

    Causality: Causal if output depends only on inputs at the present time and in the past.

  • 12

    Digital Signal Processing A.S.Kayhan

    M

    Mk

    knxM

    ny ][12

    1][

    ]1[][][ nxnxny

    Example: Causal system:

    Example: Noncausal systems:

    ][]1[][ nxnxny

    t

    dxC

    ty )(1

    )(

    Digital Signal Processing A.S.Kayhan

    Stability: Stable if small inputs do not lead to diverging outputs.

  • 13

    Digital Signal Processing A.S.Kayhan

    ]1[][][ nxnxnyExample: Stable system:

    Example: Unstable systems:

    ].[][ if ],[)1(][][ nunxnunkxnyn

    k

    Digital Signal Processing A.S.Kayhan

    Time Invariance: Time-invariant if a time shift in input causes same time shift in output signal.

  • 14

    Digital Signal Processing A.S.Kayhan

    Example:Time-varying: ][][ nnxny

    Consider two signals

    ][][],[ 121 onnxnxnx

    ][][ 11 nnxny

    ][][

    ][][

    12

    22

    onnnxny

    nnxny

    shift ][1 ny

    ][][)(][ 211 nynnxnnnny ooo

    Digital Signal Processing A.S.Kayhan

    Linearity: Linear if posses superposition property:Additivity and scaling (homogeneity):

    1. Response to is 2. Response to is

    ][][ 21 nbxnax

    ][1 nax ][1 nay

    Combining these two, we get:

    ][][ 21 nxnx

    ][][ 21 nbynay

    ][][ 21 nyny

    Example: Linear: ][][ nnxny

    Example: Nonlinear: 2])[(][ nxny

  • 15

    Digital Signal Processing A.S.Kayhan

    Linear Time-Invariant Systems:LTI systems can be analyzed in great detail.Many physical processess can be modeled by LTI systems.Unit impulse function will be used as building block and response of LTI systems to a unit impulse will be used to characterize such systems.

    Digital Signal Processing A.S.Kayhan

    Input/output relationship for a LTI system is given as:

    k

    knhkxny ][][][

    Convolution of x[n] and h[n]. h[n] is the impulse response.

    ][*][][ nhnxny

  • 16

    Digital Signal Processing A.S.Kayhan

    Example:

    Digital Signal Processing A.S.Kayhan

    Properties:Commutative:

    ][*][][*][ nxnhnhnx

    r

    knr

    k

    rhrnxknhkx ][][][][

    Use of this property:If it is easier; reflect and shift x[k] to obtain x[n-k] first, then multiply with h[k] to find convolution result at time n.

  • 17

    Digital Signal Processing A.S.Kayhan

    Associative:

    ][*])[*][(])[*][(*][ 2121 nhnhnxnhnhnx

    Digital Signal Processing A.S.Kayhan

    Distributive:

    ][*][][*][])[][(*][ 2121 nhnxnhnxnhnhnx

  • 18

    Digital Signal Processing A.S.Kayhan

    Memory: System is memoryless if output depends only on input at same time.Then, system is memoryless if:

    ][][ nKnh then ].[][ nKxny

    Similarly for continuous-time, memoryless if

    ).()( tKxty

    )()( tKth hence

    Digital Signal Processing A.S.Kayhan

    Causal: Consider convolution sum :

    k

    knxkhny ][][][

    For a LTI system to be casual y[n] must not depend on input x[k] for k > n.If system is causal :

    .0for ,0][ nnh

    Then,

    n

    kk

    knhkxknxkhny ][][][][][0

  • 19

    Digital Signal Processing A.S.Kayhan

    Stability: Stable if bounded inputs do not lead to diverging outputs. Assume

    . allfor ,][ nBnx

    Then,

    k

    knxkhny ][][][

    k

    knxkhny ][][][

    with, Bknx ][

    k

    khBny ][][

    System is stable iff,

    k

    kh ][

    Digital Signal Processing A.S.Kayhan

    Example: A system with impulse response h[n]=[n-no] shifts the input

    n n

    onnnh 1][][

    Example: Consider the fallowing accumulator

    n

    k

    kxny ][][

    Unstable][][0

    n n

    nunu

    this system has unit step as the impulse response

  • 20

    Digital Signal Processing A.S.Kayhan

    Discrete-Time Fourier Transform (DTFT):For a discrete-time signal x[n], DTFT is defined as

    n

    njj enxeX ][)(

    the inverse DTFT (synthesis equation) is defined as

    2

    )(2

    1][ deeXnx njj

    Differences between continuous-time FT and DTFT:X(ej) is periodic with 2. Integral in synthesis eq. is over 2 interval (0 to 2 or - to ).

    Digital Signal Processing A.S.Kayhan

    Example:Consider 1],[][ anuanx n

    n

    njnj nueaeX ][)(

    jn

    njj

    aeaeeX

    1

    1)()(

    0

    )cos(21

    1)(

    2

    2

    aaeX j

    )cos(1

    )sin(tan)( 1

    a

    aeX j

    )sin())cos(1(

    1)(

    jaaeX j

  • 21

    Digital Signal Processing A.S.Kayhan

    Digital Signal Processing A.S.Kayhan

    Common DTFT Pairs:

    )2(2)( allfor ,1][ leXnnx j

    1)(][][ jeXnnx

    )cos(][ nnx o

    )]2()2([)( lleX ol

    oj

    nj oenx ][

    l

    oj leX )2(2)(

  • 22

    Digital Signal Processing A.S.Kayhan

    Convergence: Analysis equation will converge if x[n] is absolutely summable or it has finite energy

    n

    nx ][

    n

    nx2

    ][

    Example:Consider

    Nn

    Nnnx

    ,0

    ,1][

    )2/sin(

    ))2/1(sin(

    1

    1)(

    )12(

    N

    e

    eeeeX

    j

    NjNj

    N

    Nn

    njj

    Digital Signal Processing A.S.Kayhan

  • 23

    Digital Signal Processing A.S.Kayhan

    Properties of DTFT:Linearity: DTFT is linear operator:

    )()(][][

    )(][

    )(][

    jj

    j

    j

    eYbeXanbynax

    eYny

    eXnx

    Time and frequency shifting:

    )(][

    )(][

    )(][

    )( oo

    o

    jnj

    jnjo

    j

    eXnxe

    eXennx

    eXnx

    Digital Signal Processing A.S.Kayhan

    Symmetry: If x[n] is real, then

    )()( * jj eXeX

    Real part is even, imaginary part is odd function of .Similarly, magnitude is even, phase is odd funtion.

    Time and frequency scaling: Time scaling is not straightforward for discrete-time signals. Consider special case; x[an], a = -1

    )(][ jeXnx

    )()(

    k of multiplenot isn if 0,

    k of multiple isn if],/[][

    1

    1

    jkj eXeX

    knxnx

  • 24

    Digital Signal Processing A.S.Kayhan

    Parsevals relation: Energy is equal on both time and frequency domains:

    2

    22

    )(2

    1][ deXnx j

    n

    Since the right hand term is the total energy in frequency domain, is called energy spectral density function (or spectrum).

    2)( jeX

    Convolution: Convolution in time corresponds to multiplication in frequency domain.

    )()()(][*][][ jjj eHeXeYnhnxny

    Digital Signal Processing A.S.Kayhan

    nj

    n

    j enheH

    ][)(

    where, is the frequency response defined as)( jeH

    Example:Consider a LTI sytem withThen the frequency response is

    ][][ onnnh

    onjj eeH )(

    For any input x[n] with Fourier transform Fourier transform of output

    )( jeX

    )()( jnjj eXeeY o

    The output is equal to the input with a time shift

    ].[][ onnxny

  • 25

    Digital Signal Processing A.S.Kayhan

    Example:Consider a LTI sytem with |a|,|b|

  • 26

    Digital Signal Processing A.S.Kayhan

    Z- Transform :For a discrete-time signal x[n], z-transform is defined as

    n

    nznxzX ][)(

    z is a general complex variable shown in polar form as jerz

    We get Fourier transform as a special case when r=1

    Digital Signal Processing A.S.Kayhan

    Convergence: Z-transform exists if

    n

    nrnx |][|

    Poles-Zeros: consider X(z) as a rational function

    )(

    )()(

    zQ

    zPzX

    where P(z) and Q(z) are polynomials in z. Values of z making X(z)=0 are called zeros of X(z) (roots of P(z)).Values of z making X(z)= are called poles of X(z) (roots of Q(z)).

  • 27

    Digital Signal Processing A.S.Kayhan

    Digital Signal Processing A.S.Kayhan

  • 28

    Digital Signal Processing A.S.Kayhan

    ||||,1

    1)( 1 azaz

    z

    azzX

    n

    n

    az || 1For convergence

    0

    1 )(][)(n

    n

    n

    nn azznuazX

    ][][ nuanx nConsiderExample:

    Digital Signal Processing A.S.Kayhan

    ||||,1

    11)( 1 azaz

    z

    zazX

    n

    n

    za || 1For convergence

    0

    1 )(1)(n

    nzazX

    ]1[][ nuanx nConsiderExample:

  • 29

    Digital Signal Processing A.S.Kayhan

    ||||||,)( bzabz

    z

    az

    zzX

    Then

    abnubnuanx nn ],1[][][

    ConsiderExample:

    ||||,][ azaz

    znua n

    ||||,]1[ bzbz

    znub n

    Digital Signal Processing A.S.Kayhan

  • 30

    Digital Signal Processing A.S.Kayhan

    Properties of convergence:ROC is a ring or disk centered at origin.DTFourier transform exists if ROC includes Unit CircleROC can not contain any polesIf x[n] has finite duration ROC is entire plane.If x[n] is right-sided, ROC is outward from outermost poleIf x[n] is left-sided, ROC is inward from innermost poleIf x[n] is two-sided, ROC is a ring not containing any pole.

    Digital Signal Processing A.S.Kayhan

    Example:

    ],1[)2(][)4.0(][ nununx nn

    |2||||4.0|,24.0

    )(

    zz

    z

    z

    zzX

  • 31

    Digital Signal Processing A.S.Kayhan

    Transfer Function: Z-transform of impulse response h[n]

    n

    nznhzH ][)(

    If impulse response h[n] is causal then ROC will be outward.If the system is causal and stable, all the poles will be inside the unit circle and ROC will include the unit circle.

    Digital Signal Processing A.S.Kayhan

    Inverse Z-Transform:Power Series Expansion: Consider

    12

    2

    11

    2

    1)( zzzzX

    remember

    1012 ]1[]0[]1[]2[

    ][)(

    zxzxzxzx

    znxzXn

    n

    therefore]1[

    2

    1][]1[

    2

    1]2[][ nnnnnx

  • 32

    Digital Signal Processing A.S.Kayhan

    Example (Long Division): |z| > |a|

    33221

    11

    1

    1)( zazaaz

    azzX

    therefore ][][ nuanx n

    Example (Long Division): |z| < |a|

    33221)( zazazaza

    zzX

    therefore ]1[][ nuanx n

    Digital Signal Processing A.S.Kayhan

    Partial fraction expansion: Consider

    kdzkk

    N

    k k

    k

    k

    N

    k

    k

    M

    k

    o

    oN

    k

    kk

    M

    k

    kk

    zXzdAzd

    A

    zd

    zc

    a

    b

    za

    zbzX

    |)()1(,1

    )1(

    )1()(

    1

    11

    1

    1

    1

    1

    0

    0

    then

    N

    k

    nk nudAnx k

    1

    ][][

  • 33

    Digital Signal Processing A.S.Kayhan

    Example : Consider

    .2

    1||,

    )21

    1)(41

    1(

    1)(

    11

    zzz

    zX

    )21

    1()41

    1()(

    1

    2

    1

    1

    z

    A

    z

    AzX

    2|)()2

    11(

    1|)()4

    11(

    2/11

    2

    4/11

    1

    z

    z

    zXzA

    zXzA

    ][4

    1][

    2

    12][ nununx

    nn

    Digital Signal Processing A.S.Kayhan

    Properties of Z-Transform:Linearity:

    )()(][][

    )(][

    )(][

    zYbzXanbynax

    zYny

    zXnx

    Time shift:

    x

    n

    RROC

    zXzzYnnxny

    zXnxo

    )()(][][

    )(][

    0

    yx RRROC

  • 34

    Digital Signal Processing A.S.Kayhan

    Multiplication by Exponential:

    xo

    ono

    RzROC

    zzXnxz

    zXnx

    ||

    )/(][

    )(][

    Conjugation:

    xRROC

    zXnx

    )(][ ***

    Digital Signal Processing A.S.Kayhan

    Time reversal:

    xRROC

    zXnx

    /1

    )/1(][ ***

    xRROC

    zXnx

    /1

    )/1(][

    Convolution:

    yx RRROC

    zYzXnxny

    )()(][*][

  • 35

    Digital Signal Processing A.S.Kayhan

    Example: ][][ nuanx n ][][ nunh

    ||||,)( azaz

    zzX

    |1|||,

    1)(

    z

    z

    zzH

    ][*][][ nhnxny

    11

    2

    11

    1

    1

    1)(

    |1|||,)1)((

    )()()(

    az

    a

    zazY

    zzaz

    zzHzXzY

    y[n] is obtained as:

    ])[][(1

    1][ 1 nuanu

    any n

    Digital Signal Processing A.S.Kayhan

    Sampling: Consider a signal x[n] which is obtained by taking samples of a continuous time signal xc(t):

    )(][ nTxnx cwhere T is the sampling period, its reciprocal, is the sampling frequency.

    Tf s1

  • 36

    Digital Signal Processing A.S.Kayhan

    Digital Signal Processing A.S.Kayhan

  • 37

    Digital Signal Processing A.S.Kayhan

    where has the quantized samples and xB[n] has the coded samples (such as 2s complement).

    ])[(][ nxQnx

    Digital Signal Processing A.S.Kayhan

  • 38

    Digital Signal Processing A.S.Kayhan

    Digital Signal Processing A.S.Kayhan

    Frequency Domain Representation of Sampling: Consider the sampled signal xs(t) obtained from xc(t) by multiplying with periodic impulse train:

    n

    nTtts )()(

    then

    n

    ccs nTttxtstxtx )()()()()(

    The discrete time signal is x[n]= xc(nT). The Fourier transform of s(t) is

    TkTS s

    ks

    2,)(

    2)(

  • 39

    Digital Signal Processing A.S.Kayhan

    Then, Fourier transform of xs(t) is

    k

    scs kXTSXX )(

    1)(*)(

    2

    1)(

    Ns 2

    Digital Signal Processing A.S.Kayhan

    Ns 2

    We observe that when the sampling frequency is not chosen high enough, copies of spectrum overlap; this is called aliasing (distortion). The minimum sampling frequency (rate) to avoid aliasing is 2N (Nyquist rate) :

    Ns T 2

    2

  • 40

    Digital Signal Processing A.S.Kayhan

    If sampling rate is greater than Nyquist rate, then the original signal xc(t) may be obtained without distortion using a low-pass filter.

    Digital Signal Processing A.S.Kayhan

    Fourier Tr. of xs(t) may be written as

    n

    njj enxeX ][)(

    n

    Tnjcs enTxX )()(

    On the other hand DTFT of x[n] is

    Comparing these equations we observe that )(|)()( TjT

    js eXeXX

    k

    cj

    T

    k

    TX

    TeX )

    2(

    1)(

    n

    cs nTttxtx )()()(

    k

    scTj kX

    TeX )(

    1)(

  • 41

    Digital Signal Processing A.S.Kayhan

    Example:Consider

    ttx oc cos)(

    Digital Signal Processing A.S.Kayhan

    )cos()( ttx or

    ))cos(()( ttx osr

  • 42

    Digital Signal Processing A.S.Kayhan

    Example: Consider

    4000,cos)( ooc ttxwith sampling period T=1/6000, we obtain

    nnTnx3

    2cos4000cos][

    Nyquist sampling condition is satisfied , there is no aliasing.

    80002120002

    os T

    Digital Signal Processing A.S.Kayhan

    Example: Consider

    16000,cos)( ooc ttxwith sampling period T=1/6000, we obtain

    nnn

    nnTnx

    3

    2cos6000/40002cos

    6000/16000cos16000cos][

    160002120002

    os T

    Nyquist sampling condition is not satisfied , there is aliasing.

  • 43

    Digital Signal Processing A.S.Kayhan

    Reconstruction from Samples:Use ideal LPF to recover original signal

    Digital Signal Processing A.S.Kayhan

    With

    n

    r nTthnxtx )(][)(

    Ttth sinc)(

    n

    r T

    nTtnxtx sinc][)(

    n

    ncs

    nTtnx

    nTtnTxtx

    )(][

    )()()(

  • 44

    Digital Signal Processing A.S.Kayhan

    Digital Signal Processing A.S.Kayhan

    Discrete-time Processing of Cont.-time Signals:

    )()(

    )(][

    THeH

    nThTnh

    cj

    c

    with h(t) is impulse response of continuous-time system

    ][ nh

  • 45

    Digital Signal Processing A.S.Kayhan

    Changing the Sampling Rate:Downsampling and Decimation:Sampling rate can be reduced by further sampling in discrete-time:

    )(][][ nMTxnMxnx cd

    Let MTT '

    Then )'(][ nTxnx cd

    Digital Signal Processing A.S.Kayhan

    If NcX for ,0)( NMTT 2

    2

    '

    2 and

    orNM

    22

    (N is BW of x[n])

    Then xc(t) can be recovered without distortion.

    Remember that

    k

    cj

    T

    k

    TX

    TeX )

    2(

    1)(

    Similarly

    k

    cj

    d T

    k

    TX

    TeX )

    '

    2

    '(

    '

    1)(

    k

    cj

    d MT

    k

    MTX

    MTeX )

    2(

    1)(

  • 46

    Digital Signal Processing A.S.Kayhan

    Let

    otherwise,0

    ,2,,0],[][1

    MMnnxnx

    neM

    nxnxM

    l

    Mnlj ,1

    ][][1

    0

    /21

    ( [ ]=Discrete Fourier Series rep. of impulse train with period M )

    ][][][ 1 MnxMnxnx d

    nj

    n

    nj

    nd

    jd eMnxenxeX

    ][][)( 1

    MknMnk /

    Mkj

    k

    jd ekxeX

    /1 ][)(

    Digital Signal Processing A.S.Kayhan

    1

    0

    //2

    /1

    0

    /2

    ][1

    1][)(

    M

    l k

    MkjMlkj

    Mkj

    k

    M

    l

    Mlkjjd

    eekxM

    eeM

    nxeX

    1

    0

    )2

    ()(

    1)(

    M

    l

    M

    l

    Mjj

    d eXMeX

    Combining the exponential terms

    First obtain then shift by increments to get)( Mj

    eX

    2

    )( )/2'( MljeX

  • 47

    Digital Signal Processing A.S.Kayhan

    Digital Signal Processing A.S.Kayhan

  • 48

    Digital Signal Processing A.S.Kayhan

    IfNM

    22

    Digital Signal Processing A.S.Kayhan

    A general system for downsampling called decimator is

  • 49

    Digital Signal Processing A.S.Kayhan

    Upsampling and Interpolation:Sampling rate can be increased by obtaining intermediate values:

    2,/'),'(][ LLTTnTxnx cigiven ).(][ nTxnx c

    ,2,,0),/(]/[][ LLnLnTxLnxnx ci Consider the following system

    Digital Signal Processing A.S.Kayhan

    The block with inserts (L-1) zeros between samples:L

    otherwise,0

    2,,0,/][

    LLnLnxnx e

    or

    .][ kLnkxnxk

    e

    In frequency domain:

    n

    nj

    k

    je ekLnkxeX

    )(

    )()( Ljk

    kLjje eXekxeX

  • 50

    Digital Signal Processing A.S.Kayhan

    L=2

    Digital Signal Processing A.S.Kayhan

    k

    i LkLn

    LkLnkxnx

    /)(

    /)(sin][][

    Ln

    Lnnh

    /

    /sin

  • 51

    Digital Signal Processing A.S.Kayhan

    Changing the sampling rate by noninteger factor:Following system may be used

    Digital Signal Processing A.S.Kayhan

  • 52

    Digital Signal Processing A.S.Kayhan

    End of Part 1

  • 1Digital Signal Processing A.S.Kayhan

    DIGITAL SIGNAL

    PROCESSING

    Part 2

    Digital Signal Processing A.S.Kayhan

    Frequency Analysis of LTI Systems:the Input/Output (I/O) relation of a LTI system is given by convolution:

    k

    knxkhnhnxny ][][][*][][

    In z-domain)()()( zHzXzY

    jez

    jjj eHeXeY

    )()()(

    On the unit circle

    where is the frequency response of the system.

    )( jeH

  • 2Digital Signal Processing A.S.Kayhan

    )()()( jjj eHeXeY

    Magnitude is

    where is the magnitude response of the system.

    )( jeH

    Phase is )()()( jjj eHeXeY

    where is the phase response of the system.

    )( jeH

    Digital Signal Processing A.S.Kayhan

    Discrete-time ideal filters: LPF, HPF, BPF:

    These are not realizable. Why?

  • 3Digital Signal Processing A.S.Kayhan

    Phase distortion and delay:Assume that ][][ did nnnh

    thendnjj

    id eeH )(

    ord

    jid

    jid neHeH

    )(,1)(

    Linear phase distortion causes simple delay.

    Group delay: It measures linearity of the phase response.Consider nnsnx ocos][][ where is a narrowband (slowly varying) signal.][ ns

    Digital Signal Processing A.S.Kayhan

    Assume around o

    dojj neHeH )(,1)(

    Then doood nnnnsny cos][][

    Thus, group delay of a system is

    )(arg)]([

    jj eHd

    deHgrd

    where is the continuous phase. )(arg jeH

  • 4Digital Signal Processing A.S.Kayhan

    Digital Signal Processing A.S.Kayhan

    Example: Consider the following filter

  • 5Digital Signal Processing A.S.Kayhan

    Input is the following signal

    Digital Signal Processing A.S.Kayhan

    Pulses are at 85.0,5.0,25.0

  • 6Digital Signal Processing A.S.Kayhan

    Systems with Difference Equation Models:Assume that the Input/Output (I/O) relation of a system is given by a constant coefficient difference equation:

    M

    kk

    N

    kk knxbknya

    00

    ][][

    Applying z-transform, using linearity and shifting properties, we obtain

    M

    k

    kk

    N

    k

    kk zXzbzYza

    00

    )()(

    )()(00

    zXzbzYzaM

    k

    kk

    N

    k

    kk

    Digital Signal Processing A.S.Kayhan

    Then, the transfer function (or system function) is

    N

    k

    kk

    M

    k

    kk

    za

    zb

    zX

    zYzH

    0

    0

    )(

    )()(

    We can write the transfer function in terms of its poles, dk, and zeros, ck, as

    N

    kk

    M

    kk

    o

    o

    zd

    zc

    a

    bzH

    1

    1

    1

    1

    )1(

    )1()(

  • 7Digital Signal Processing A.S.Kayhan

    Example: Consider system function

    )4

    31)(

    2

    11(

    )1()(

    11

    21

    zz

    zzH

    )(

    )(

    83

    41

    1

    21)(

    21

    21

    zX

    zY

    zz

    zzzH

    then

    )()8

    3

    4

    11()()21( 2121 zYzzzXzz

    ]2[8

    3]1[

    4

    1][

    ]2[]1[2][

    nynyny

    nxnxnx

    Digital Signal Processing A.S.Kayhan

    Stability and Causality: A system is causal if ROC for the transfer function H(z) is outward.A sytem is stable if ROC for the transfer function H(z) includes the unit circle.

  • 8Digital Signal Processing A.S.Kayhan

    Inverse Systems :Let be the inverse system of , then )( zH)( zH i

    1)()()( zHzHzG i

    then

    )(

    1)(,

    )(

    1)(

    j

    jii eH

    eHzH

    zH

    Not all systems have an inverse. Ideal LPF does not have an inverse, we can not recover high frequency components.Now, consider

    N

    kk

    M

    kk

    o

    o

    zd

    zc

    a

    bzH

    1

    1

    1

    1

    )1(

    )1()(

    nnhnhng i *Eq.(1)

    Digital Signal Processing A.S.Kayhan

    Then the inverse system has

    M

    kk

    N

    kk

    o

    oi

    zc

    zd

    b

    azH

    1

    1

    1

    1

    )1(

    )1()(

    Poles become zeros of the inverse system, zeros become poles. For Eq.(1) to hold, ROC of and must overlap. If is causal, ROC is

    )( zH i )( zH)( zH

    kdz max

    Some part of ROC of must overlap with this.)( zH i

  • 9Digital Signal Processing A.S.Kayhan

    Example: Suppose

    9.0,9.01

    5.0)(

    1

    1

    zz

    zzH

    The inverse system is

    1

    1

    1

    1

    21

    8.12

    5.0

    9.01)(

    z

    z

    z

    zzH i

    Two possible ROC:

    2z nununh nni 11 28.1121which is stable but noncausal.

    2z 128.12 112

    nununh nni

    unstable but causal.

    Digital Signal Processing A.S.Kayhan

    Example: Suppose

    9.0,9.01

    5.01)(

    1

    1

    zz

    zzH

    1

    1

    5.01

    9.01)(

    z

    zzH i

    The inverse system is

    The only choice for ROC is overlaps with is 9.0z

    5.0z

    then

    15.09.05.0 1 nununh nni

    which is both stable and causal.

  • 10

    Digital Signal Processing A.S.Kayhan

    Impulse Response for Rational System:Assume that a stable LTI system has a rational transfer function.

    N

    kk

    M

    kk

    o

    o

    zd

    zc

    a

    bzH

    1

    1

    1

    1

    )1(

    )1()(

    N

    k k

    kNM

    NMifr

    rr zd

    AzBzH

    11

    00 1

    )(

    then

    N

    k

    nkk

    NM

    rr nudArnBnh

    10

    1

    Impulse response is of infinite length, called Infinite Impulse Response (IIR) system.

    Digital Signal Processing A.S.Kayhan

    If the system has no poles, then

    M

    k

    kk zbzH

    0

    )(

    M

    kk knbnh

    1

    Impulse response is of finite length, called Finite Impulse Response (FIR) system.

    Example: Consider a causal system with][]1[][ nxnayny

    If then stable and the impulse response is

    1a

    .nuanh n

  • 11

    Digital Signal Processing A.S.Kayhan

    Example: Consider .

    otherwise,0

    0,

    Mna

    nhn

    Then

    1

    11

    0 1

    1)(

    az

    zazazH

    MMM

    n

    nn

    Zeros at

    .,,1,0,12

    Mkaez Mk

    j

    k

    Difference equation is

    However, we can also write

    1][]1[][ 1 Mnxanxnayny M

    M

    k

    k knxany1

    Digital Signal Processing A.S.Kayhan

    Frequency Response for Rational System Functions:Assume that a stable LTI system has a rational transfer function. Then frequency response is obtained by evaluating it on the unit circle:

    N

    k

    kjk

    M

    k

    kjk

    j

    ea

    eb

    eH

    0

    0)(

    N

    k

    jk

    M

    k

    jk

    o

    oj

    ed

    ec

    a

    beH

    1

    1

    )1(

    )1()(

  • 12

    Digital Signal Processing A.S.Kayhan

    The magnitude response of the system is

    N

    k

    jk

    M

    k

    jk

    o

    oj

    ed

    ec

    a

    beH

    1

    1

    1

    1)(

    The magnitude-squared response of the system is

    )()()( *2 jjj eHeHeH

    N

    k

    jk

    jk

    M

    k

    jk

    jk

    o

    oj

    eded

    ecec

    a

    beH

    1

    *

    1

    *2

    2

    11

    11)(

    Digital Signal Processing A.S.Kayhan

    Log magnitude or Gain in decibels(dB) :

    N

    k

    jk

    M

    k

    jk

    o

    oj

    ed

    eca

    beH

    110

    1101010

    1log20

    1log20log20)(log20

    Attenuation in dB = - Gain in dB

    Note that :

    )(log20

    )(log20)(log20

    10

    1010

    j

    jj

    eX

    eHeY

  • 13

    Digital Signal Processing A.S.Kayhan

    Phase response for rational system function:

    N

    k

    jk

    M

    k

    jk

    o

    oj

    ed

    eca

    beH

    1

    1

    1

    1)(

    Group delay for rational system function:

    N

    k

    jk

    M

    k

    jk

    j

    edd

    d

    ecd

    deH

    1

    1

    ]1arg[

    ]1arg[)(grd

    Digital Signal Processing A.S.Kayhan

    Frequency Response of A single Zero:Consider transfer function of a system as

    11)( azzH

    then with jrea jjeHjjj ereeeHeH

    j 1)()( )(

    then magnitude is

    and magnitude in dB is

    )cos(21)( 22

    rreH j

    )]cos(21[Log20)(Log20 21010 rreH j

  • 14

    Digital Signal Processing A.S.Kayhan

    then phase is

    )cos(1

    )sin(tan)( 1

    r

    reH j

    group delay is derivative of the (unwrapped) phase function

    d

    eHdeHgrd

    jj ))(()]([

    Example: Consider two cases : r=0.9, =0 and r=0.9, =:

    Digital Signal Processing A.S.Kayhan

  • 15

    Digital Signal Processing A.S.Kayhan

    magnitudes of vectors give the magnitude response

    31

    3)( vv

    v

    e

    reeeH

    j

    jjj

    jezz

    azzH

    )(

    Digital Signal Processing A.S.Kayhan

    phases of vectors give the phase response

    31313

    )(

    vv

    e

    reeeH

    j

    jjj

  • 16

    Digital Signal Processing A.S.Kayhan

    Example: Consider a second order system with

    11

    1

    11

    1)(

    zrezre

    zezH

    jj

    j

    21

    3)(vv

    veH j

    Digital Signal Processing A.S.Kayhan

    jez

    j zHeH

    )()(

    :

  • 17

    Digital Signal Processing A.S.Kayhan

    Example: Consider a third order system with

    211

    211

    7957.04461.11683.01

    0166.11105634.0)(

    zzz

    zzzzH

    Digital Signal Processing A.S.Kayhan

    Relation Between Magnitude and Phase:In general, knowledge about magnitude does not provide information about phase, and vice versa.But, for rational system functions, with some additional information such as number of poles and zeros, magnitude and phase responses provide information about each other.Consider

    jez

    jjj

    zHzH

    eHeHeH

    |)/1()(

    )()()(

    **

    *2

    with

    N

    kk

    M

    kk

    o

    o

    zd

    zc

    a

    bzH

    1

    1

    1

    1

    )1(

    )1()(

  • 18

    Digital Signal Processing A.S.Kayhan

    N

    kk

    M

    kk

    o

    o

    zd

    zc

    a

    bzH

    1

    *

    1

    *

    **

    )1(

    )1()/1(

    Then

    N

    kkk

    M

    kkk

    o

    o

    zdzd

    zczc

    a

    bzHzHzC

    1

    *1

    1

    *12

    **

    )1)(1(

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

    Notice that poles and zeros of C(z) occur in conjugate reciprocal pairs. If one pole/zero is inside the unit circle there is another outside.

    Digital Signal Processing A.S.Kayhan

    If H(z) is causal and stable, then all poles must be inside the unit circle, with this we can identify the poles. But zeros of H(z) can not be uniquely identified from zeros of C(z) with this constraint alone.

    Example: Consider two stable systems with

    14/14/

    11

    1 8.018.01

    5.0112)(

    zeze

    zzzH

    jj

    and

    14/14/

    11

    2 8.018.01

    211)(

    zeze

    zzzH

    jj

  • 19

    Digital Signal Processing A.S.Kayhan

    Pole/zero plots are

    Digital Signal Processing A.S.Kayhan

    zezezeze

    zzzz

    zHzHzC

    jjjj 4/4/14/14/

    11

    **111

    8.018.018.018.01

    5.01125.0112

    )/1()()(

    zezezeze

    zzzz

    zHzHzC

    jjjj 4/4/14/14/

    11

    **222

    8.018.018.018.01

    211211

    )/1()()(

    Observe that (with )

    zzzz 21215.015.014 11

    then

    )()( 21 zCzC

    1224 zz

  • 20

    Digital Signal Processing A.S.Kayhan

    Example: Consider pole/zero plot of C(z) for a system, determine H(z).

    For a causal and stable system, poles of H(z) are: p1, p2,p3.For real ak, bk, zeros/poles occur in complex conjugate pairs.

    Digital Signal Processing A.S.Kayhan

    All-Pass Systems:Consider following stable system function

    1

    *1

    1)(

    az

    azzH ap

    j

    jj

    j

    jj

    ap ae

    aee

    ae

    aeeH

    1

    )1(

    1)(

    **

    then constant )(but ,1)( jap

    jap eHeH

    This is called an all-pass system .A general all-pass system has the following form

    cr M

    k kk

    kkM

    k k

    kap zeze

    ezez

    zd

    dzAzH

    11*1

    1*1

    11

    1

    )1)(1(

    ))((

    1)(

  • 21

    Digital Signal Processing A.S.Kayhan

    Example: Consider pole/zero plot of a typical all-pass system

    Digital Signal Processing A.S.Kayhan

    Example: First order all-pass system with a real pole: z=0.9 (z=-0.9)

  • 22

    Digital Signal Processing A.S.Kayhan

    Example: Second order all-pass system with poles:4/9.0 jez

    Digital Signal Processing A.S.Kayhan

    Notice that group delay for causal all-pass systems are positive (unwrapped/continuous phase is nonpositive).All-pass systems may be used as phase compensators.They are also useful in transforming lowpass filters into other frequency-selective forms.

  • 23

    Digital Signal Processing A.S.Kayhan

    Block-Diagram Representation:LTI systems with difference equation represetation (rational system function) may be imlemented by converting to an algorithm or structure that can be realized in desired technology. These structures consists of basic operations of addition, multiplication by a constant and delay.In block diagram representation:

    Digital Signal Processing A.S.Kayhan

    Example: Consider the second order system :][]2[]1[][ 21 nxbnyanyany o

    with

    22

    111

    )(

    zaza

    bzH o

    Block diagram representation is

  • 24

    Digital Signal Processing A.S.Kayhan

    For a system with higher order difference equation

    M

    kk

    N

    kk knxbknyany

    01

    ][][][

    with system function

    N

    k

    kk

    M

    k

    kk

    za

    zbzH

    1

    0

    1)(

    Rewriting the equation as

    ][][

    ][][][

    1

    01

    nvknya

    knxbknyany

    N

    kk

    M

    kk

    N

    kk

    where

    M

    kk knxbnv

    0

    ][][

    Digital Signal Processing A.S.Kayhan

    N+MDelayelement

    Direct Form I:

  • 25

    Digital Signal Processing A.S.Kayhan

    Previous diagram is implementation of

    M

    k

    kkN

    k

    kk

    zbza

    zHzHzH0

    1

    21

    1

    1)()()(

    or

    )()()()(0

    1 zXzbzXzHzVM

    k

    kk

    )(1

    1)()()(

    1

    2 zVza

    zVzHzY N

    k

    kk

    Digital Signal Processing A.S.Kayhan

    We can rearrange the system function

    )(1

    1)()()(

    1

    2 zXza

    zXzHzW N

    k

    kk

    )()()()(0

    1 zWzbzWzHzYM

    k

    kk

    In the time domain

    M

    kk knwbny

    0

    ][][

    ][][][1

    nxknwanwN

    kk

  • 26

    Digital Signal Processing A.S.Kayhan

    M = N

    Digital Signal Processing A.S.Kayhan

    Direct Form II:

    Max(N,M)Delay elements

  • 27

    Digital Signal Processing A.S.Kayhan

    Example:Consider the system with

    21

    1

    9.05.11

    21)(

    zz

    zzH

    Digital Signal Processing A.S.Kayhan

    Flow Graph Representation:Similar to the block diagram representation:

  • 28

    Digital Signal Processing A.S.Kayhan

    Example:Consider the system with

    )()()( 41 zXzWzW )()( 12 zWzW )()()( 23 zXzWzW

    )()( 31

    4 zWzzW

    )()()( 42 zWzWzY

    Digital Signal Processing A.S.Kayhan

    1

    1

    1)(

    z

    zzH

    )(1

    )(1

    1

    zXz

    zzY

  • 29

    Digital Signal Processing A.S.Kayhan

    Structures for IIR Systems:Some considerations:Computaional complexity(no. of multiplication, delay )Finite precision, Ease of implementation, etc.

    Direct Forms:We have already seen direct forms.

    Cascade Form:We factor numerator and denominator polynomials of H(z)

    21

    21

    1

    1*1

    1

    1

    1

    1*1

    1

    1

    )1)(1()1(

    )1)(1()1()( N

    kkk

    N

    kk

    M

    kkk

    M

    kk

    zdzdzc

    zgzgzfAzH

    Digital Signal Processing A.S.Kayhan

    We have cascade of first or second order subsystems

    s

    ss

    N

    k kk

    kk

    o

    N

    k kk

    kkokN

    kk

    zaza

    zbzbb

    zaza

    zbzbbzHzH

    12

    21

    1

    22

    ~1

    1

    ~

    12

    21

    1

    22

    11

    1

    1

    1

    1)()(

  • 30

    Digital Signal Processing A.S.Kayhan

    Example:Consider the system with

    11

    11

    21

    21

    25.015.01

    11

    125.075.01

    21)(

    zz

    zz

    zz

    zzzH

    Digital Signal Processing A.S.Kayhan

    Parallel Form:H(z) may be written as sum of subsystems

    crf N

    k kk

    kkN

    kk

    k

    kN

    kk zdzd

    zeB

    zc

    AzCzH

    01*1

    1

    00

    1

    )1)(1(

    )1(

    1)(

    N

    k kk

    kokN

    kk zaza

    zeezCzH

    f

    02

    21

    1

    11

    0

    1

    1)(

  • 31

    Digital Signal Processing A.S.Kayhan

    Digital Signal Processing A.S.Kayhan

    Example:Consider the system with

    112121

    25.01

    25

    5.01

    188

    125.075.01

    21)(

    zzzz

    zzzH

  • 32

    Digital Signal Processing A.S.Kayhan

    Transposed Forms :Reverse the directions of all branches while keeping the values as they were and reverse roles of input and output. Transposed forms may be useful in finite precision implementation.

    Example:Consider the second order system with

    Digital Signal Processing A.S.Kayhan

    Structures for FIR Systems:Consider an FIR system with following input-output relation

    ][][0

    knxbnyM

    kk

    Observe that the impulse response of this system is

    otherwise,0

    0,][

    Mnbnh n

    Direct form (or tapped delay line or transversal filter) :

  • 33

    Digital Signal Processing A.S.Kayhan

    Transposed direct form structure:

    Digital Signal Processing A.S.Kayhan

    ss N

    kkkok

    N

    kk zbzbbzHzH

    1

    22

    11

    1

    )()()(

    Cascade form:

  • 34

    Digital Signal Processing A.S.Kayhan

    Linear-Phase FIR Systems:Finite impulse response (FIR) systems with linear-phase have symmetry properties such as

    MnnMhnh 0],[][

    MnnMhnh 0],[][or

    For M even and odd. Thus there are four types of linear phase FIR filters.

    Digital Signal Processing A.S.Kayhan

    )2/sin(

    )2/5sin()( 2

    jj eeH

    otherwise,0

    40,1][

    nnh

    Example: Consider

  • 35

    Digital Signal Processing A.S.Kayhan

    Example: Consider

    ]2[]1[2][][ nnnnh

    )].cos(1[2

    2

    21)(

    1

    111

    21

    j

    jjj

    jjj

    e

    eee

    eeeH

    Digital Signal Processing A.S.Kayhan

    Assume M is even

    M

    Mk

    M

    k

    M

    k

    knxkh

    MnxMhknxkh

    knxkhny

    12/

    12/

    0

    0

    ][][

    ]2/[]2/[][][

    ][][][

    With, in the last term, k=M-l, l=0M/2-1

    12/

    0

    12/

    0

    ][][

    ]2/[]2/[][][][

    M

    l

    M

    k

    lMnxlMh

    MnxMhknxkhny

  • 36

    Digital Signal Processing A.S.Kayhan

    ][][ nMhnh If

    ]2/[]2/[

    ])[][]([][12/

    0

    MnxMh

    kMnxknxkhnyM

    k

    If ][][ nMhnh

    ])[][]([][12/

    0

    kMnxknxkhnyM

    k

    Digital Signal Processing A.S.Kayhan

    Finite-Precision Numerical Effects:Input Quantization:We have seen earlier that continuous-time signals are sampled, quantized and coded first

  • 37

    Digital Signal Processing A.S.Kayhan

    Example:

    Digital Signal Processing A.S.Kayhan

    In twos complement binary system leftmost bit is the sign bit. If we have (B+1)-bit twos complement fraction of the following form

    Baaaa 210 Value is B

    Baaaa 2222 22

    11

    00

    Example: Binary Code Numeric value

    110 4/3

    101 2/1

    011 4/1

  • 38

    Digital Signal Processing A.S.Kayhan

    Quantizer step size is12

    2

    B

    mX

    With][][

    ^^

    nxXnx Bmwhere

    )complement s(two'1][1^

    nx B

    Analysis of Quantization Errors:We observe that the quantized samples are in general different from the true values. The difference is the quantization error

    ].[][][^

    nxnxne

    and2/][2/ ne

    Digital Signal Processing A.S.Kayhan

    A simplified model of quantizer is

    Assumptions about e[n]:e[n] is stationarye[n] is uncorrelated with x[n]e[n] is white noisee[n] is uniformly distributed

  • 39

    Digital Signal Processing A.S.Kayhan

    Example:

    3bit quantizer

    Error for 3bit

    Error for 8bit

    Sinusoidal signal

    Digital Signal Processing A.S.Kayhan

    Mean value of e[n] is zero

    012/

    2/

    deee

    Variance (or power) of e[n] is

    12

    1 22/

    2/

    22

    deee

    For (B+1)-bit quantizer with full-scale value Xm

    12

    2 222 mXB

    e

  • 40

    Digital Signal Processing A.S.Kayhan

    Signal-to-Noise Ratio (SNR) is defined as the ratio of signal variance (power) to noise variance. Expressed in dB

    x

    m

    m

    xB

    e

    x

    XB

    X

    10

    2

    22

    102

    2

    10

    log208.1002.6

    212log10log10SNR

    If

    6dB-SNRSNR,2/

    dB 6SNRSNR,1

    xx

    BB

    Digital Signal Processing A.S.Kayhan

    Coefficient Quantization in IIR Systems:Consider

    N

    k

    kk

    M

    k

    kk

    za

    zbzH

    1

    0

    1)(

    If the coefficients are quantized, we get

    N

    k

    kk

    M

    k

    kk

    za

    zbzH

    1

    ^

    0

    ^

    ^

    1)(

    wherekkkkkk aaabbb

    ^^

    ,

  • 41

    Digital Signal Processing A.S.Kayhan

    Each pole or zero will be affected by all the errors in the coefficient quantization. If the poles (or zeros) are close to each other (clustered), then quantization of coefficients may cause large shifts of poles (or zeros).Direct form structures are more sensitive to coefficient quantization than the other forms (parallel, cascade,...)

    Digital Signal Processing A.S.Kayhan

    Example: Consider a bandpass IIR elliptic filter of order 12 implemented in cascade form of 2nd order subsystems and direct form.

  • 42

    Digital Signal Processing A.S.Kayhan

    Passband cascade unquantized

    Passband cascade 16-bit

    Digital Signal Processing A.S.Kayhan

    Passband parallel 16-bit

    Direct form 16-bit

  • 43

    Digital Signal Processing A.S.Kayhan

    Poles of Quantized 2nd order subsystems :Because of robustness, parallel and cascade forms are used more than direct forms.We can further improve the robustness, by improving implementation of the 2nd order subsystems. Consider the following implementation in direct form:

    Digital Signal Processing A.S.Kayhan

    When coefficients are quantized, a finite number of pole possitions possible.

    4bits 7bits

    Circles correspond to r2, vertical lines to 2rcos

  • 44

    Digital Signal Processing A.S.Kayhan

    Consider the following coupled form

    Digital Signal Processing A.S.Kayhan

    4bits 7bits

  • 45

    Digital Signal Processing A.S.Kayhan

    Coefficient Quantization in FIR Systems:Consider FIR system with transfer function

    M

    n

    nznhzH0

    ][)(

    If][][][

    ^

    nhnhnh

    )()(][)(0

    ^

    zHzHznhzHM

    n

    n

    then

    where

    M

    n

    nznhzH0

    ][)(and

    )()()(^

    jjj eHeHeH

    Digital Signal Processing A.S.Kayhan

    Example: Consider FIR filter of order 27

  • 46

    Digital Signal Processing A.S.Kayhan

    Digital Signal Processing A.S.Kayhan

    Effects of Round-off Noise:Analysis of Direct Form IIR Structures:Consider Nth-order difference equation for Direct Form I

    M

    kk

    N

    kk knxbknyany

    01

    ][][][

    Assume that all signal values and coefficients are represented by (B+1)-bit fixed point binary numbers. Therefore, each multiplication is followed by a quantizer, then

    M

    kk

    N

    kk knxbQknyaQny

    01

    ^^

    ][][][

  • 47

    Digital Signal Processing A.S.Kayhan

    Digital Signal Processing A.S.Kayhan

    An alternative representation is as following

  • 48

    Digital Signal Processing A.S.Kayhan

    Rounding or truncation of a product bx[n] is represented by a noise source of the form

    ][][][ nbxnbxQne

    Assumptions about e[n]s:Each e[n] is stationaryEach e[n] is uncorrelated with x[n] and other e[n]sEach e[n] is uniformly distributed

    For (B+1)-bit rounding

    2/2][2/2 BB ne

    Digital Signal Processing A.S.Kayhan

    For (B+1)-bit truncation

    0][2 neB

    Mean and variance for rounding are

    0e 122 22

    B

    e

    Mean and variance for truncation are

    2

    2 Be

    12

    2 22B

    e

  • 49

    Digital Signal Processing A.S.Kayhan

    Now, lets try to determine effect of quantization noise on the output of the system. We can redraw the system as

    ][][][][][][ 43210 nenenenenene

    Digital Signal Processing A.S.Kayhan

    Since all the noise sources are

    12

    255

    22222222

    043210

    B

    eeeeeee

    For the general Direct Form I case

    12

    21

    22

    B

    e NM

    Now, we observe that

    ][][][1

    neknfanfN

    kk

    For rounding mean of the output noise is zero.The variance for rounding or truncation is

    22

    2 ][12

    21

    n

    ef

    B

    f nhNM

    is impulse response for ][ nh ef )(/1)( zAzH ef

  • 50

    Digital Signal Processing A.S.Kayhan

    Example: Consider the following system

    .1,1

    )(1

    aazb

    zH

    ][][ nuanh nef

    Then the noise variance(power) at the output is

    2222

    2

    1

    1

    12

    22

    12

    22

    aa

    Bn

    n

    B

    f

    Digital Signal Processing A.S.Kayhan

    Analysis of Direct Form FIR systems:Consider

    M

    k

    knxkhny0

    ][][][

    12

    21,][][][

    22

    0

    B

    f

    M

    kk Mnenenf

  • 51

    Digital Signal Processing A.S.Kayhan

    End of Part 2

  • 1Digital Signal Processing A.S.Kayhan

    DIGITAL SIGNAL

    PROCESSING

    Part 3

    Digital Signal Processing A.S.Kayhan

    IIR Filters:Infinite impulse response (IIR) filters have rational transfer functions as

    N

    k

    kk

    M

    k

    kk

    za

    zbzH

    0

    0)(

    Some IIR filter types are: Butterworth, Chebyshev, Elliptical. IIR filters have to be stable. IIR filters may not have linear-phase.

  • 2Digital Signal Processing A.S.Kayhan

    Filter Specifications (Low-pass):

    )(log20 10

    Design analog filter transform to Digital filter

    Digital Signal Processing A.S.Kayhan

    Analog Butterworth Filters:Approximate ideal LPF with magnitude-squared response

    c

    cKH,0

    ,)(

    2

    by the following rational function:

    0,11

    )(22

    1

    221

    212

    nn

    n

    nn b

    bb

    aaKH

    |H()|2 must be even function of , and denominator degree must be higher than degree of numerator (lowpass).

  • 3Digital Signal Processing A.S.Kayhan

    .1,,2,1, niba ii

    .1)( 22

    nnb

    KH

    Then, we have

    For maximal flatness at the origin, =0, The first 2n-1 derivatives of |H()|2 must be zero. This requires

    Maximal flatness also at , =, requires

    0,11

    )(22

    1

    221

    212

    nn

    n

    nn b

    bb

    bbKH

    .1,,2,1,0 niba ii

    Digital Signal Processing A.S.Kayhan

    .

    1

    1)( 2

    2

    n

    o

    H

    Then, we have the Butterworth response

    Let |H(=0)|2 = 1. Then

    At the half-power frequency

    n

    onn

    on

    bb

    H

    2

    2

    2 1

    1

    1

    2

    1)(

    .11

    )(2

    2

    nnb

    H

  • 4Digital Signal Processing A.S.Kayhan

    Consider the filter specifications:

    .dB)(log20 10 H

    .dB1log10

    2

    10

    n

    o

    n

    o

    2

    10/ 110 no 2/110/ 110

    Using max and pn

    o

    p

    2

    10/ 110 max

    Using min and sn

    o

    s

    2

    10/ 110 min

    To find n:

    Digital Signal Processing A.S.Kayhan

    Dividing these equations

    n

    p

    s

    2

    10/

    10/

    110

    110max

    min

    Taking logarithm, we get the filter order as:

    p

    s

    nlog2

    110

    110log 10/

    10/

    max

    min

  • 5Digital Signal Processing A.S.Kayhan

    then, set the denominator to zero

    We can normalize the frequency so that o = 1. Then

    To find the filter poles, we let =s/j,

    nnn sjssHsH

    22 )1(1

    1

    )/(1

    1)()(

    .11

    )(2

    2

    nH

    1)1(0)1(1 22 nnnn ss

    If n is even, then

    .12,...,1,0,

    .12,...,1,0,1

    )2

    21(

    )2(2

    nkes

    nkes

    n

    kj

    k

    kjn

    Digital Signal Processing A.S.Kayhan

    If n is odd, then

    .12,...,1,0,

    .12,...,1,0,1 22

    nkes

    nkes

    n

    kj

    k

    kjn

    Note that all the poles lie on a circle with radius 1, because the frequency is normalized. (If we want to design analog filter we need to correct this). Also, choose the poles in the left-half plane to get a stable filter.

  • 6Digital Signal Processing A.S.Kayhan

    Example: Design specs. for a Butterworth LP filter:At f = 2000 Hz, max= 3dBAt f = 3000 Hz, min= 10dBThen, the filter order n isn 2.7154 n = 3.Poles are at

    .5,...,1,0,3 kesk

    j

    k

    .

    ))23

    21

    ())(23

    21

    ()(1(

    1

    )1)(1(

    1)(

    2

    jsjss

    ssssH

    Digital Signal Processing A.S.Kayhan

    Analog Chebyshev Filters:We can generalize Butterworth response as:

    .)(11

    )(1

    1)(

    22

    2

    nn F

    H

    Fn() is a function of . Now, consider:

    ))(coscos()cos(

    )(cos)cos(1

    1

    xnny

    xx

    n

    This is the Chebyshev polynomial of order n. When

    ))(coshcosh()(,1 1 xnxCx n

    When x 1 , Cn(x) 0.

  • 7Digital Signal Processing A.S.Kayhan

    Cn(x) has zeros in -1< x < 1 :

    -1 0 1-1

    0

    1

    x

    C1(x)

    -1 0 1-1

    0

    1

    x

    C2(x)

    -1 0 1-1

    0

    1

    x

    C3(x)

    -1 0 1-1

    0

    1

    x

    C4(x)

    -1 0 1-1

    0

    1

    x

    C5(x)

    .)(,1)(

    ),()(2)(

    1

    11

    xxCxC

    xCxCxxC

    o

    nnn

    Digital Signal Processing A.S.Kayhan

    Use Cn(.) in :

    )(1

    1)(

    22

    2

    nCH

    ))(coscos()(,1

    ))(coshcosh()(,11

    1

    nC

    nC

    n

    n

    2 1 , is known as the ripple factor.

  • 8Digital Signal Processing A.S.Kayhan

    Behaviour at =0:

    even isn if,)1(

    1)0(,1)(

    odd isn if,1)0(,0)(

    2

    22

    22

    HC

    HC

    n

    n

    Behaviour at =1:

    )1(

    1)1(

    n allfor ,1)(

    2

    2

    2

    H

    C n

    Digital Signal Processing A.S.Kayhan

    110)(1log10 10max/22 nCThe attenuation is

    When .dB01.31)(22 nC

    This defines the half-power frequency (3dB cut-off) hp.Then,

    ).1()).1

    (cosh1

    cosh(

    )1

    (cosh1

    )(cosh

    ))(coshcosh(1

    )(

    1

    11

    1

    hphp

    hp

    hphpn

    n

    n

    nC

  • 9Digital Signal Processing A.S.Kayhan

    The specifications for a Chebyshev filter are max, min, s(p=1). Bandpass is between 0 1 rad/s.To find n:

    )(110

    )(1log102210/

    22min

    minsn

    sn

    C

    C

    With 110 10max/2

    110

    110))(coshcosh(

    10/

    10/1

    max

    min

    sn

    Finally,

    )(cosh

    110110cosh

    1

    10/

    10/1

    max

    min

    s

    n

    Digital Signal Processing A.S.Kayhan

    To find the filter poles, we let =s/j,

    )/(1

    1)()(

    22 jsCsHsH

    n

    then

    1

    )/(0)/(1 22 jjsCjsC nn

    Letjsjvuw /)cos()cos(

    wjs )/(cos 1

    With

    )sinh()sin()cosh()cos()/(

    )cos())/(coscos()/( 1

    nvnujnvnujsC

    nwjsnjsC

    n

    n

    )cosh(2

    )cos(,2

    )cos( xee

    jxee

    xxxjxjx

  • 10

    Digital Signal Processing A.S.Kayhan

    With

    1

    )/( jjsC n then

    1

    )sinh()sin(

    0)cosh()cos(

    nvnu

    nvnu

    cosh(nv) can never be zero, therefore cos(nu) must be zero. It is possible for

    .12,,1,0),12(2

    ,2

    5,

    2

    3,

    2

    nkkn

    u

    nnnu

    k

    k

    Digital Signal Processing A.S.Kayhan

    For these values of u, sin(nu) = 1, then

    .)1

    (sinh1 1 an

    v k

    Remember that

    jvuwjs )/(cos 1then

    jakn

    jwjs kk 122cos)cos(

    The poles are :12,,1,0, nkjs kkk

    )cosh()2

    12cos(

    )sinh()2

    12sin(

    an

    k

    an

    k

    k

    k

    Choose left half poles.

  • 11

    Digital Signal Processing A.S.Kayhan

    Discrete Time Filter Design(IIR):There are 3 approches:1-Sampling (Impulse invariance)2-Bilinear transformation3-Optimal procedures

    Impulse invariance method:We can sample the impulse response hc(t) of an analog filter with desired specifications as (Td is sampling interval):

    .][ dcd nThTnh then

    ).2

    ()( kTT

    HHdk d

    c

    Digital Signal Processing A.S.Kayhan

    If dc TH /,0)( then

    .),()(

    d

    c THH

    Analog and digital frequencies have a linear relation: . dT

    Consider the transfer function of a system expressed as

    ,)(1

    N

    k k

    kc ss

    AsH

    Then, the impulse response is

    .0,)(1

    teAthN

    k

    tskc

    k

  • 12

    Digital Signal Processing A.S.Kayhan

    The impulse response of the discrete time filter is

    .)(

    )(

    1

    1

    nueATnh

    nueATnThTnh

    N

    k

    nTskd

    N

    k

    nTskddcd

    dk

    dk

    Transfer (or system) function of the discrete time filter is

    .1

    )(1

    1

    N

    kTs

    kd

    ze

    ATzH

    dk

    Poles are .dk Tsk ezss

    If Hc(s) is stable (k < 0), then H(z) is also stable (|z| < 1).

    Digital Signal Processing A.S.Kayhan

    Example: Transfer function of analog filter is

    .

    )23

    21

    (

    12

    121

    )23

    21

    (

    12

    121

    1

    1

    )1)(1(

    1)(

    2

    js

    j

    js

    j

    s

    ssssH c

    then

    .

    1

    )12

    121

    (

    1

    )12

    121

    (

    1)(

    )2

    3

    2

    1(1)2

    3

    2

    1(1

    1

    jT

    d

    jT

    d

    Td

    dd

    d

    ez

    jT

    ez

    jT

    ez

    TzH

  • 13

    Digital Signal Processing A.S.Kayhan

    Bilinear Transformation:Transformation needed to convert an analog filter to a discrete time filter must have following properties:1- j axis of the s-plane must be mapped onto the unit circle of the z-plane,2- stable analog filters must be tranformed into stable discrete time filters (left hand plane of the s-plane must be mapped into inside the unit circle of the z-plane).Following BT satisfies these conditions:

    ./1

    /1

    1

    11

    1

    Ks

    Ksz

    z

    zKs

    Digital Signal Processing A.S.Kayhan

    Let jrezjs ,

    then

    .)/()/1(

    )/()/1(22

    222

    KK

    KKr

    Therefore

    )u.c. theinside(1)planeLH(0 r

    )u.c. the(1)axis (0 rj

    )u.c. theoutside(1)planeRH(0 r

  • 14

    Digital Signal Processing A.S.Kayhan

    Digital Signal Processing A.S.Kayhan

    Now, let jezjs ,

    then.

    )(

    )(

    1

    12/2/2/

    2/2/2/

    jjj

    jjj

    j

    j

    eee

    eeeK

    e

    eKj

    ).2/tan()2/cos(

    )2/sin(

    jKKjj

    or).2/tan( K

  • 15

    Digital Signal Processing A.S.Kayhan

    Observations:1- According to Taylor series expansion of tan(), for small

    .2/24/2/ 3 KK 2- For high frequencies, the relation is nonlinear causing a distortion called warping effect. Therefore, BT is usually used for the design of LPF to avoid this.

    Digital Signal Processing A.S.Kayhan

    Discrete Butterworth Filter Design:

    We convert a frequency normalized analog Butterworth filterto a discrete filter using the BT.

    Normalized half power frequecy HP=1 is mapped into the discrete half power frequency HP. To do that, we set K to

    ).2/cot()2/tan(/)1( HPHPHPbK

  • 16

    Digital Signal Processing A.S.Kayhan

    Then, we use ).5.0tan(/)5.0tan()5.0tan( HPbK

    in nnH 2

    2

    1

    1)(

    And get the discrete Butterworth Low Pass Filter as:

    n

    HP

    nH 22

    )5.0tan()5.0tan(

    1

    1)(

    Using the design specifications, we find the filter order as

    )5.0tan()5.0tan(log2

    110110log 10/

    10/

    max

    min

    p

    s

    n

    Digital Signal Processing A.S.Kayhan

    The half-power freq. is

    npHP 2/110/

    1

    110

    )5.0tan(tan2

    max

    ).5.0cot( HPbK

    Example: Consider the second order analog filter

    )12(

    1)(

    22

    sssH

    Applying the BT, we get (Kb = 1)

    2929.0)1716.0(

    )1()(

    2

    2

    2

    z

    zzH

  • 17

    Digital Signal Processing A.S.Kayhan

    Remarks:1- Given the specs.:

    a) find the filter order nb) obtain the analog filter H(s)(using LHP poles)c) calculate HP and Kbd) use biliear transformation to find H(z).

    2- H(z) is BIBO stable, because H(s) is stable.3- Applying the BT to high order filters may be tedious. Therefore, first express H(s) as product or some of first and second order functions, then apply the BT.

    Digital Signal Processing A.S.Kayhan

    Example: Design specs. for a LP digital Butterworth filter:At f = 0 Hz, 1= 18dBAt f = 2250 Hz, 2= 21dBAt f = 2500 Hz, 3= 27dBSampling freq. fsmp= 9000 Hz(ej0)= 18dBmax = 2 1=3dBmin = 3 1=9dB smp

    ss

    smp

    pp f

    f

    f

    f 2,2

    Filter order n 5.52,n = 6, Kb = 1 and a gain G for = 18dB

    )02.0.0)(17.0)(59.0(

    )1(0037.0)(

    222

    6

    6

    zzz

    zzH

  • 18

    Digital Signal Processing A.S.Kayhan

    Discrete Chebyshev Filter Design:

    We find the constant K by transforming (normalized passband freq.) P=1 into the discrete passband frequency P. We get

    )5.0tan(/)5.0tan()5.0tan(/1 PPcK

    And get the discrete Chebyshev Low Pass Filter as:

    ))5.0tan(/)5.0(tan(1

    1)(

    22

    2

    pnCH

    Digital Signal Processing A.S.Kayhan

    Using C1(1)=1, we let max, p

    110

    1log10

    10/

    2max

    min

    Also using min, sWe find the filter order

    )]5.0tan(/)5.0[tan(cosh

    110110cosh

    1

    10/

    10/1

    max

    min

    ps

    n

  • 19

    Digital Signal Processing A.S.Kayhan

    Example: Design specs. for a LP digital Chebyshev filter:At f = 0 Hz, 1= 0dBAt f = 2250 Hz, max= 3dBAt f = 2500 Hz, min= 10dBSampling freq. fsmp= 9000 Hz

    Filter order n = 3, Kc = 1

    )54.0)(72.015.0(

    )1(09.0)(

    2

    3

    3

    zzz

    zzH

    smp

    ss

    smp

    pp f

    f

    f

    f 2,2

    Digital Signal Processing A.S.Kayhan

    Example: Design specs. for a LP digital Chebyshev filter:At = 2/5 rad, max= 1dBAt = /2 rad, min= 9dB

    Filter order n = 3

    )472.0)(619.0505.0(

    )1(736.0)(

    2

    3

    3

    zzz

    zzH

    Example: Design specs. for a LP digital Butterworth filter:At = /2 rad, max= 3dB = 0 rad, = 0dBAt = 5/9 rad, min= 10dB

    Filter order n = 7, Kb = 1

    )052.0)(232.0)(636.0(

    )1(01656.0)(

    222

    7

    7

    zzzz

    zzH

  • 20

    Digital Signal Processing A.S.Kayhan

    Frequency Transformations:

    The objective is to obtain transfer functions of other types of dicrete filters from already available prototype Low Pass Filters using tranformation functions g(z) as

    ))(()( zgHzH LP

    Example: Design specs. for a LP digital Chebyshev filter:At f = 0 Hz, = 0dBAt f = 2250 Hz, 2= 21dBAt f = 2500 Hz, 3= 27dBSampling freq. fsmp= 9000 Hz

    Digital Signal Processing A.S.Kayhan

    39.0802.0691.0

    )1(09.0)(

    23

    3

    zzz

    zzH LPF

  • 21

    Digital Signal Processing A.S.Kayhan

    Now, we want a HPF with cutt-off at 3.6kHz, we use following transformation

    )5095.01(

    )5095.0(1

    11

    z

    zz

    6884.0102.2361.2

    )133(0066.0)(

    23

    23

    zzz

    zzzzH HPF

    Digital Signal Processing A.S.Kayhan

    Design of FIR Filters by Windowing:

    Ideal frequency response and corresponding impulse response functions are .),( nheH djd

    Generally hd[n] is infinitely long. To obtain a causal practical FIR filter, we can truncate it as

    otherwise.,0

    0, Mnnhnh d

    In a general form we can write it as nwnhnh d

    Where w[n] is window function.

  • 22

    Digital Signal Processing A.S.Kayhan

    In frequency domain, we have

    .)()(2

    1)(

    deWeHeH jjdj

    Digital Signal Processing A.S.Kayhan

    Some commonly used window functions are Rectangular, Bartlett, Hamming, Hanning, Blackman, Kaiser.

    Some important factors in choosing windows are: Main lobe width and Peak side lobe level. For rectangular:

  • 23

    Digital Signal Processing A.S.Kayhan

    Main lobe width and transition region; Peak side lobe level and oscillations of filter are related.

    Digital Signal Processing A.S.Kayhan

  • 24

    Digital Signal Processing A.S.Kayhan

    Digital Signal Processing A.S.Kayhan

  • 25

    Digital Signal Processing A.S.Kayhan

    Discrete Time Fourier Series (DTFS):

    Consider a periodic sequence with period N:

    .][11

    0

    2~~

    N

    k

    nkN

    jekX

    Nnx

    Which can be represented by a Fourier series as:

    .][21

    0

    ~~ nkN

    jN

    n

    enxkX

    The DTFS coefficients are obtained as:

    .~~

    Nnxnx

    nx~

    Digital Signal Processing A.S.Kayhan

    Let NjN eW

    2

    The DTFS analysis and synthesis equations are:

    .][1

    0

    ~~nk

    N

    N

    n

    WnxkX

    .][11

    0

    ~~

    N

    k

    nkNWkXN

    nx

    Example: Consider the periodic impulse train:

    r

    rNnnx ][~

    The DTFS

    . allfor 1][1

    0

    ~

    kWnkX nkNN

    n

  • 26

    Digital Signal Processing A.S.Kayhan

    Similarly, ][~~

    lkXnxW nlN

    Properties: 1- Linearity: It is linear.2- Shift of a sequence: If ][

    ~~

    kXnx

    then ][~~

    kXWmnx kmN

    3- Periodic convolution: Consider two periodic sequences with period N

    ][~

    1

    ~

    1 kXnx ][~

    2

    ~

    2 kXnx

    Then,

    ][][][~

    2

    ~

    1

    ~

    3 kXkXkX .][][1

    0

    ~

    2

    ~

    13

    ~

    N

    m

    mxmnxnx

    Digital Signal Processing A.S.Kayhan

    Example: Consider periodic convolution of two sequences:

  • 27

    Digital Signal Processing A.S.Kayhan

    Sampling the Fourier Transform:

    Consider signal x[n] with DTFT X() and assume by sampling X() , we get

    kN

    XXkXk

    N

    2|)(][ 2

    ~

    ][~

    kX could be the sequence of DTFS coefficients of a periodic signal which may be obtained as

    .][11

    0

    ~~

    N

    k

    nkNWkXN

    nx

    Digital Signal Processing A.S.Kayhan

    Substituting,

    k

    Nm

    mj XkXemxX 2

    ~

    |)(,

    .*~

    rr

    rNnxrNnnxnx then,

  • 28

    Digital Signal Processing A.S.Kayhan

    If N is too small, then aliasing occurs in the time domain.

    If there is no aliasing, we can recover x[n].

    Digital Signal Processing A.S.Kayhan

    Discrete Fourier Tranform (DFT):

    DFT is obtained by taking samples of the DTFT. Remember DTFT is defined as:

    n

    njj enxeX ][)(

    We take samples of X(ej) at uniform intervals as:

    .1,1,0,)(][ 2

    NkeXkXk

    N

    j

    We define: N

    j

    N eW2

  • 29

    Digital Signal Processing A.S.Kayhan

    Then the DFT is defined as (analysis equation):

    N

    n

    knNWnxkX

    0

    ][][

    for k=0,1,...,N-1. The inverse DFT is defined as (synthesis equation):

    N

    n

    knNWkXN

    nx0

    ][1

    ][

    for n=0,1,...,N-1.

    Digital Signal Processing A.S.Kayhan

    Example:N=5

  • 30

    Digital Signal Processing A.S.Kayhan

    N=10

    Digital Signal Processing A.S.Kayhan

    Properties:1- Linearity: DFT is a linear operation.2- Circular shift:

    ].[10,2

    kXeNnmnxkm

    Nj

    N

  • 31

    Digital Signal Processing A.S.Kayhan

    3- Circular convolution:

    kXkXkX

    mxmnxnxnxnxN

    mN

    213

    1

    021213 ][][

    Example:

    Digital Signal Processing A.S.Kayhan

    Example: N=L

  • 32

    Digital Signal Processing A.S.Kayhan

    N=2L

    Digital Signal Processing A.S.Kayhan

    4- Multiplication(Modulation):

    .213213 kXkXkXnxnxnx

    Linear Convolution Using the DFT:

    Since there are efficient algorithms to take DFT, like FFT, we can use it instead of direct convolution as:

    1. Compute N point DFTs, 2. Multiply them to get 3. Compute the inverse DFT, to get:

    . and 21 kXkX .213 kXkXkX

    nxnxnx 213

  • 33

    Digital Signal Processing A.S.Kayhan

    Linear Convolution of Finite Length Signals:Consider two sequences x1[n] of length L and x2[n] of

    length P, and x3[n] = x1[n]* x2[n].Observe that x3[n] will be of length (L+P-1).

    Circular Convolution as Linear Convolution with Aliasing :

    Consider again x1[n] of length L and x2[n] of length P, and x3[n] = x1[n]* x2[n].

    )()()( 213 jjj eXeXeX

    Digital Signal Processing A.S.Kayhan

    Taking N samples .213 kXkXkX

    Now, taking the inverse DFT, we have

    otherwise.,0

    10,33

    NnrNnxnx

    rp

    nxnxnx p 213

    This circular convolution is identical to the linear convolution corresponding to X1(ej) X2(ej), if N (L+P-1).

  • 34

    Digital Signal Processing A.S.Kayhan

    Example:

    Digital Signal Processing A.S.Kayhan

    Example:

  • 35

    Digital Signal Processing A.S.Kayhan

    Digital Signal Processing A.S.Kayhan

    LTI Systems Using the DFT :Consider x[n] of length L and h[n] of length P, and y[n] =

    x[n]* h[n] will be of length (L+P-1).To obtain the result of linear convolution using the DFT,

    we must use N ( (L+P-1))-point DFTs. For that x[n] and h[n] must be augmented with zeros (zero-padding).

    Overlap-Add Method :Consider h[n] of length P, and length of x[n] is much

    grater than P.We can write x[n] as combination of length L segments:

    ,otherwise,0

    10,

    LnrLnx

    nx r

    r

    r rLnxnx

  • 36

    Digital Signal Processing A.S.Kayhan

    Since the system is LTI then

    nhnxnyrLnyny rrr

    r *,

    Each output segment yr[n] can be obtained using (L+P-1) point DFT.

    Example:

    Digital Signal Processing A.S.Kayhan

  • 37

    Digital Signal Processing A.S.Kayhan

    Overlap-Save Method :Consider again h[n] of length P, and length of x[n] is much

    grater than P.In this method L-point circular convolution (or DFT) is

    used. Since the first (P-1) points will be incorrect, input segments must overlap.

    We can write each L sample segment of x[n] as :

    10,)1()1( LnPPLrnxnx r

    11,

    ,)1()1(

    LnPnyny

    PPLrnyny

    rpr

    rr

    Digital Signal Processing A.S.Kayhan

    Example:

  • 38

    Digital Signal Processing A.S.Kayhan

    Efficient Computation of the DFT :Remember the definition of the DFT and inverse DFT

    1

    0

    ][][N

    n

    knNWkXnx

    1

    0

    ][][N

    n

    knNWnxkX

    N2 comlex multiplications and N(N-1) additions or 4N2 real mult. and 4N(N-2) real additions necessary:

    N

    n

    knN

    knN

    knN

    knN

    Wnx

    Wnxj

    Wnx

    Wnx

    kX0

    }Re{}][Im{

    }Im{}][Re{

    }Im{}][Im{

    }Re{}][Re{

    ][

    Digital Signal Processing A.S.Kayhan

    To improve the efficiency, we can use some properties as:

    nNkN

    knN

    nNkN

    knN

    knN

    nNkN

    WWW

    WWW)()(

    *)(

    )2

    )()1

    }.Re{}][Re{}][Re{}Re{}][Re{}Re{}][Re{ )(

    knN

    nNkN

    knN

    WnNxnx

    WnNxWnx

    Example:

  • 39

    Digital Signal Processing A.S.Kayhan

    Fast Fourier Transform(FFT):Fast Fourier Transform algorithms are used to implement DFT efficiently to reduce the number of multiplication and addition operations.Two main algorithms are:Decimation in time and Decimation in frequency. Both these algorithms require that N=2m.The number of operations using either of these will require (N/2)log2N complex multiplications and Nlog2Nadditions.Direct implementation of DFT requires N2 complex multiplications and additions. For N=1024= 210

    N2=1048576 but Nlog2N=10240.

    Digital Signal Processing A.S.Kayhan

    Decimation in time FFT Algorithm:Assume N=2m

    1,,1,0,][][1

    0

    NkWnxkXN

    n

    knN

    Which can be written as

    oddn

    knN

    evenn

    knN WnxWnxkX ][][][

    With n = 2r (even) and n = 2r+1 (odd)

    .

    ]12[)(]2[

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

    12/

    02/

    12/

    02/

    12/

    0

    212/

    0

    2

    kHWkG

    WrxWWrx

    WrxWWrxkX

    kN

    N

    rN

    kN

    N

    rN

    N

    r

    rkN

    kN

    N

    r

    rkN

    rkrk

  • 40

    Digital Signal Processing A.S.Kayhan

    .][ kHWkGkX kN

    Requires N+2(N/2)2 multiplications

    Digital Signal Processing A.S.Kayhan

    Since G[k] and H[k] requires 2(m-1)-point DFTs, each one can be similarly decomposed until we reach 2-point DFTs.

  • 41

    Digital Signal Processing A.S.Kayhan

    Digital Signal Processing A.S.Kayhan

    Butterfly:(in place comp.)

    Bit reversed order

  • 42

    Digital Signal Processing A.S.Kayhan

    Decimation in frequency FFT Algorithm:Again assume N=2m

    1,,1,0,][][1

    0

    NkWnxkXN

    n

    knN

    then)12/(,,1,0,][]2[

    1

    0

    2

    NrWnxrXN

    n

    rnN

    1

    2/

    212/

    0

    2 ][][]2[N

    Nn

    rnN

    N

    n

    rnN WnxWnxrX

    12/

    0

    )2/(212/

    0

    2 ]2/[][]2[N

    n

    NnrN

    N

    n

    rnN WNnxWnxrX

    12/

    0

    12/

    02/2/ ][])2/[][(]2[

    N

    n

    N

    n

    rnN

    rnN WngWNnxnxrX

    Digital Signal Processing A.S.Kayhan

    Similarly for

    .][

    ])2/[][(]12[

    12/

    02/

    12/

    02/

    N

    n

    rnN

    nN

    N

    n

    rnN

    nN

    WWnh

    WWNnxnxrX

    )12/(0 Nr

  • 43

    Digital Signal Processing A.S.Kayhan

    Procedure is repeated until 2-point DFTs

    Digital Signal Processing A.S.Kayhan

    Computation of Inverse DFT:

    1,,1,0,][1

    ][0

    NnWkXN

    nxN

    n

    knN

    1,,1,0,][][0

    NkWnxkXN

    n

    knN

    ][DFT1][1][ *0

    ** kXN

    WkXN

    nxN

    n

    knN

    ** ][DFT1][ kXN

    nx

  • 44

    Digital Signal Processing A.S.Kayhan

    End of Part 3

  • 1Digital Signal Processing A.S.Kayhan

    DIGITAL SIGNAL

    PROCESSING

    Part 4

    J.S. Lim, Two Dimensional Signal Processing, in Advanced Topics In Signal Processing, Prentice-Hall.

    Digital Signal Processing A.S.Kayhan

    Signals:Impulses: The 2-D impulse is,

    otherwise,0

    0,1, 2121

    nnnn

  • 2Digital Signal Processing A.S.Kayhan

    Any sequence may be represented as a linear combination of shifted impulses:

    ].,[],[, 221121211 2

    knknkkxnnxk k

    21, nnx

    Digital Signal Processing A.S.Kayhan

    Line impulses are:

    otherwise,0

    0,1, 1121

    nnnnx T

  • 3Digital Signal Processing A.S.Kayhan

    or

    otherwise,0

    0,1, 2221

    nnnnx T

    Digital Signal Processing A.S.Kayhan

    or

    otherwise,0

    ,1, 212121

    nnnnnnx T

  • 4Digital Signal Processing A.S.Kayhan

    Step sequence:

    otherwise,0

    0,,1, 2121

    nnnnu

    ].,[,1

    1

    2

    2

    2121

    n

    k

    n

    k

    kknnu

    or

    1,11,,1,, 2121212121 nnunnunnunnunn

    Digital Signal Processing A.S.Kayhan

    Separable sequences:A separable sequence can be written as

    221121, nfnfnnx The impulse is separable

    2121, nnnn Periodic sequences:

    is periodic with period N1xN2 if 21,~ nnx 22121121 ,~,~,~ NnnxnNnxnnx

    Example: Periodic with 2x4

    2121 )2/(cos,~ nnnnx

  • 5Digital Signal Processing A.S.Kayhan

    Linearity: A system is linear if

    Systems:The relation between the input and the response of the system is given by

    .,, 2121 nnxFnny

    21 , nnx

    .,,,, 212211212211 nnybnnyannxbnnxaF where .2,1,,, 2121 innxFnny ii

    Time Invariance: A system is time-invariant if

    .,, 22112211 mnmnymnmnxF

    Digital Signal Processing A.S.Kayhan

    Convolution:For a LSI system with impulse response, , the input/output relation is given by

    Where * denotes 2-D convolution.

    Convolution with a delayed impulse :

    21 , nnh

    ].,[],[

    ,*,,

    221121

    212121

    1 2

    knknhkkx

    nnhnnxnny

    k k

    ].,[,*, 2211221121 mnmnxmnmnnnx

  • 6Digital Signal Processing A.S.Kayhan

    Example:

    Digital Signal Processing A.S.Kayhan

    ].,[],[, 221121211 2

    knknhkkxnnyk k

  • 7Digital Signal Processing A.S.Kayhan

    If the impulse response is separable

    221121, nhnhnnh then

    1

    1 2

    1 2

    21111

    22221111

    2221112121

    ,][

    ][],[][

    ][][],[,

    k

    k k

    k k

    nkfknh

    knhkkxknh

    knhknhkkxnny

    Digital Signal Processing A.S.Kayhan

    Stability: A system is BIBO stable iff a bounded input leads to a bounded output. If

    then the system is BIBO stable.

    1 2

    ],[ 21n n

    nnh

  • 8Digital Signal Processing A.S.Kayhan

    Discrete Space Fourier Transform (2D F.T.):

    .),()2(

    1,

    ,),(

    2121221

    2121

    2211

    1 2

    2211

    1 2

    ddeeXnnx

    eennxX

    njnj

    njnj

    n n

    is periodic with 2 in both variables.),( 21 X

    ).2,(),2(),( 212121 XXX

    2D Fourier Transform and its inverse are defined as

    Digital Signal Processing A.S.Kayhan

    Example:

  • 9Digital Signal Processing A.S.Kayhan

    Frequency Response:

    If the input to Linear Shift Invariant (LSI) system is

    2211],[ 21njnj eennx

    then 2211),(],[ 2121

    njnj eeHnny

    where

    22111 2

    2121 ,),(kjkj

    k k

    eekkhH

    is the frequency response function of the system.

    Digital Signal Processing A.S.Kayhan

    Example:Given LPF

    otherwise,0

    and,1),( 2121

    baH

    This function can be written as

    ).()(),( 221121 HHH

  • 10

    Digital Signal Processing A.S.Kayhan

    .)sin()sin(

    ][][],[2

    2

    1

    1221121

    n

    bn

    n

    annhnhnnh

    then

    Digital Signal Processing A.S.Kayhan

    Example:Given impulse response and magnitude response of a 2D LPF as

  • 11

    Digital Signal Processing A.S.Kayhan

    Original LP-Filtered HP-Filtered

    Digital Signal Processing A.S.Kayhan

    Example:Given frequency response of a 2D LPF as

    2122

    21

    22

    21

    21,and,0

    ,1),(

    c

    cH

  • 12

    Digital Signal Processing A.S.Kayhan

    where J1(x) is the Bessel function.

    2221122

    21

    212

    ],[ nnJnn

    nnh cc

    then the impulse response sequence is

    Digital Signal Processing A.S.Kayhan

    2D Z-Transform:

    211 2

    212121 ,),(nn

    n n

    zznnxzzX

    2D Z-Transform is defined as

    where z1 and z2 are complex variables. The space represented by (z1, z2) is four-dimesional (4-D).

  • 13

    Digital Signal Processing A.S.Kayhan

    Example:Given 2D sequence 2121 ,],[ 21 nnubannx nn

    then

    bzazbzazz

    b

    z

    a

    zznnubazzX

    n n

    nn

    nn

    n n

    nn

    2112

    110 0 21

    212121

    and,1

    1

    1

    1

    ,),(

    1 2

    21

    21

    1 2

    21

    Digital Signal Processing A.S.Kayhan

    Inverse Z-Transform:2-D polynomials, in general, can not be factored as a product of lower order polynomials, therefore the partial fraction expansion is not a general procedure for 2-D signals.

    Linear, Constant Coefficient Difference Eq.:LCCDE is given in the following form

    221121),(

    221121),(

    ,,,,2121

    knknxkkbknknykkakk Rkk R BA

    where a and b are known, with boundary conditions.

  • 14

    Digital Signal Processing A.S.Kayhan

    Example:Given an IIR filter with a first quadrant impulse response as

    12

    11

    21 5.01

    1),(

    zzzzH

    then

    12

    1121

    2121 5.01

    1

    ),(

    ),(),(

    zzzzX

    zzYzzH

    ),(),(5.0),( 211

    21

    12121 zzXzzzzYzzY

    ],[]1,1[5.0],[ 212121 nnxnnynny

    Digital Signal Processing A.S.Kayhan

    End of Part 4