2

52
1 Digital 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

Transcript of 2

  • 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