Chap 5 - Time Frequency Wavelet

Embed Size (px)

Citation preview

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    1/62

    1

    Advanced signal processing

    Dr. Mohamad KAHLIL

    Islamic University of Lebanon

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    2/62

    2

    Chapter 4: Time frequency and

    wavelet analysis

    Definition

    Time frequency

    Shift time fourier transform

    Winer-ville representations and others

    Wavelet transform

    Scalogram

    Continuous wavelet transform

    Discrete wavelet transform: details and approximations applications

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    3/62

    3

    The Story of Wavelets

    Theory and Engineering Applications

    Time frequency representation

    Instantaneous frequency and group delay

    Short time Fourier transformAnalysis

    Short time Fourier transformSynthesis

    Discrete time STFT

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    4/62

    4

    Signal processing

    Signal Processing

    Time-domain techniques Freq.-domain techniques

    Filters Fourier T.

    Non/Stationary Signals Stationary Signals

    TF domain techniques

    WAVELET

    TRANSFORMS

    STFT

    CWT DWT MRA 2-D DWT SWT ApplicationsDenoising

    Compression

    Signal Analysis

    Disc. Detection

    BME / NDEOther

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    5/62

    5

    FT At Work

    )52cos()(1 ttx

    )252cos()(2 ttx

    )502cos()(3 ttx

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    6/62

    6

    FT At Work

    )(1X

    )(2X

    )(3X

    )(1 tx

    )(2 tx

    )(3 tx

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    7/62

    7

    FT At Work

    )502cos(

    )252cos(

    )52cos()(4

    t

    t

    ttx

    )(4X)(4 tx

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    8/62

    8

    Stationary and Non-stationary

    Signals

    FT identifies all spectral components present in the signal, however itdoes not provide any information regarding the temporal (time)localization of these components. Why?

    Stationary signals consist of spectral components that do not change intime

    all spectral components exist at all times

    no need to know any time information

    FT works well for stationary signals

    However, non-stationary signals consists of time varying spectralcomponents

    How do we find out which spectral component appears when?

    FT only provides what spectral components exist , not where intime they are located.

    Need some other ways to determine time locali zation of spectralcomponents

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    9/62

    9

    Stationary and Non-stationary

    Signals

    Stationary signals spectral characteristics do not change with time

    Non-stationary signals have time varying spectra

    )502cos()252cos(

    )52cos()(4

    tt

    ttx

    ][)( 3215 xxxtx Concatenation

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    10/62

    10

    Non-stationary Signals

    5 Hz 20 Hz 50 Hz

    Perfect knowledge of what

    frequencies exist, but no

    information about where

    these frequencies are

    located in time

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    11/62

    11

    FT Shortcomings

    Complex exponentials stretch out to infinity in time

    They analyze the signal globally, not locally

    Hence, FT can only tell what frequencies exist in theentire signal, but cannot tell, at what time instances

    these frequencies occur

    In order to obtain time localization of the spectral

    components, the signal need to be analyzed locally

    HOW ?

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    12/62

    12

    Short Time Fourier Transform

    (STFT)

    1. Choose a window function of finite length

    2. Put the window on top of the signal at t=0

    3. Truncate the signal using this window

    4. Compute the FT of the truncated signal, save.5. Slide the window to the right by a small amount

    6. Go to step 3, until window reaches the end of the signal

    For each time location where the window is centered, we

    obtain a different FT

    Hence, each FT provides the spectral information of a

    separate time-slice of the signal, providing

    simultaneous time and frequency information

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    13/62

    13

    STFT

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    14/62

    14

    STFT

    t

    tjx dtettWtxtSTFT )()(),(

    STFT of signal x(t):

    Computed for each

    window centered at t=t

    Time

    parameter

    Frequency

    parameterSignal to

    be analyzed

    Windowing

    function

    Windowing function

    centered at t=t

    FT Kernel

    (basis function)

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    15/62

    15

    0 100 200 300-1.5

    -1

    -0.5

    0

    0.5

    1

    0 100 200 300-1.5

    -1

    -0.5

    0

    0.5

    1

    0

    100

    200

    300

    -1.5

    -1

    -0.5

    0

    0.5

    1

    0

    100

    200

    300

    -1.5

    -1

    -0.5

    0

    0.5

    1

    Windowed

    sinusoid allows

    FT to be

    computed only

    through the

    support of thewindowing

    function

    STFT at Work

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    16/62

    16

    STFT

    STFT provides the time information by computing a different FTs forconsecutive time intervals, and then putting them together

    Time-Frequency Representation (TFR)

    Maps 1-D time domain signals to 2-D time-frequency signals

    Consecutive time intervals of the signal are obtained by truncating thesignal using a sliding windowing function

    How to choose the windowing function?

    What shape? Rectangular, Gaussian,

    Elliptic?How wide?

    Wider window require less time stepslow time resolution

    Also, window should be narrow enough to make sure that the

    portion of the signal falling within the window is stationary Can we choose an arbitrarily narrow window?

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    17/62

    17

    Selection of STFT Window

    Two extreme cases:

    W(t)infinitely long: STFT turns into FT, providingexcellent frequency information (good frequency resolution), but no timeinformation

    W(t)infinitely short:

    STFT then gives the time signal back, with a phase factor. Excellenttime information (good time resolution), but no frequency information

    Wide analysis windowpoor time resolution, good frequency resolution

    Narrow analysis windowgood time resolution, poor frequency resolution

    Once the window is chosen, the resolution is set for both time and frequency.

    t

    tjx dtettWtxtSTFT

    )()(),(

    1)( tW

    )()( ttW

    tj

    t

    tjx etxdtetttxtSTFT

    )()()(),(

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    18/62

    18

    Heisenberg Principle

    4

    1 ft

    Time resolution:How welltwo spikes in time can be

    separated from each other in

    the transform domain

    Frequency resolution:Howwell two spectral components

    can be separated from each

    other in the transform domain

    Both time and frequency resolutions cannot be arbitrarily high!!!We cannot precisely know at what time instance a frequency component is

    located. We can only know what interval of frequencies are present in which time

    intervals

    http://engineering.rowan.edu/~polikar/WAVELETS/WTpart2.html

    http://engineering.rowan.edu/~polikar/WAVELETS/WTpart2.htmlhttp://engineering.rowan.edu/~polikar/WAVELETS/WTpart2.html
  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    19/62

    19

    STFT

    .. ..

    time

    Amplitud

    e

    Frequency ..

    ..

    t0 t1 tk tk+1 tn

    Th Sh Ti F i

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    20/62

    20

    The Short Time Fourier

    Transform

    Take FT of segmented consecutive pieces of a signal. Each FT then provides the spectral content of that time

    segment only

    Spectral content for different time intervals

    Time-frequency representation

    ttjx dtetWtxSTFT )()(),(

    STFT of signal x(t):

    Computed for each

    window centered at t=localized s ectrum

    Time

    parameter Frequency

    parameter

    Signal to

    be analyzed

    Windowing

    function

    (Analysis window)

    Windowing function

    centered at t=

    FT Kernel

    (basis function)

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    21/62

    Alt t R t ti

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    22/62

    22

    Alternate Representation

    of STFT

    deXetSTFT

    dfefffXeftSTFT

    tjtjx

    ftj

    f

    tfjx

    )~()()~,(

    )~

    ()()~

    ,(

    *~)(

    2*~

    2)(

    STFT : The inverse FT of the windowed spectrum,with a phase factor

    )

    ~

    ()( *

    fffX

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    23/62

    23

    Filter Interpretation of STFT

    ftj

    ftj

    f

    ettxfffX

    dfefffXfffXF

    2*

    2**1

    )()()~

    ()(

    )~

    ()()~

    ()(

    X(t) is passed through a bandpass filter with a center frequency of

    Note that (f) itself is a lowpass filter.

    f~

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    24/62

    24

    Filter Interpretation of STFT

    x(t) ftjet 2)( X

    ftje 2

    ),()(

    ftSTFTx

    x(t) )( t ),()( ftSTFTx

    X

    ftje 2

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    25/62

    25

    Resolution Issues

    time

    Amplitude

    Fre

    quency

    k

    All signal attributes

    located within the local

    window interval

    around t will appear

    at t in the STFT

    )( kt

    n

    )( kt

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    26/62

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    27/62

    27

    Time-Frequency Resolution

    Time

    Frequency

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    28/62

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    29/62

    29

    300 Hz 200 Hz 100Hz 50Hz

    STFT Example

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    30/62

    30

    2/2

    )( at

    et

    STFT Example

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    31/62

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    32/62

    32

    a=0.001

    STFT Example

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    33/62

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    34/62

    34a=0.00001

    STFT Example

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    35/62

    35

    Discrete Time Stft

    n k

    kFtjx enTtgkFnTSTFTtx

    2)( )(),()(

    dtenTttxkFnTSTFT kFtj

    t

    x

    2*)(

    )()(),(

    The Story of Wavelets

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    36/62

    36

    Timefrequency resolution problem

    Concepts of scale and translation

    The mother of all oscillatory little basis functions

    The continuous wavelet transform

    Filter interpretation of wavelet transform

    Constant Q filters

    The Story of Wavelets

    Theory and Engineering Applications

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    37/62

    37

    TimeFrequency Resolution

    Timefrequency resolution problem with STFT

    Analysis window dictates both time and frequency

    resolutions, once and for all

    Narrow windowGood time resolution

    Narrow band (wide window)Good frequency

    resolution

    When do we need good time resolution, when do we need

    good frequency resolution?

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    38/62

    38

    Scale & Translation

    Translationtime shift

    f(t)f(a.t) a>0

    If 00

    If 0

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    39/62

    39

    The Mother of All Oscillatory

    Little Basis Functions

    The kernel functions used in Wavelet transform are all obtained fromone prototype function, by scaling and translating the prototype

    function.

    This prototype is called the mother wavelet

    a

    1

    )(1)(,a

    bt

    atba

    Scale parameter

    Translationparameter

    )()(0,1 tt

    Normalization factor to ensure that allwavelets have the same energy

    dttdttdttba22

    )0,1(

    2

    ),( )()()(

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    40/62

    40

    Continuous Wavelet Transform

    dt

    abttx

    abaWbaCWTx )(1),(),()(

    Normalization factor

    Mother wavelettranslation

    Scaling:

    Changes the support of

    the wavelet based on

    the scale (frequency)

    CWT of x(t) at scalea and translation b

    Note: low scale high frequency

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    41/62

    41

    Computation of CWT

    ),1( NbW

    ),5( NbW

    time

    Amplitude

    b0

    ),1( 0bW

    bN

    time

    Amplitude

    b0

    ),5( 0bW

    bN

    time

    Amplitu

    de

    b0

    ),10( 0bW

    bN

    ),10( NbW

    time

    Amplitude

    b0

    ),25( 0bW

    bN

    ),25( NbW

    dta

    bt

    txabaWbaCWTx

    )(

    1

    ),(),()(

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    42/62

    42

    WT at WorkHigh frequency (small scale)

    Low frequency (large scale)

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    43/62

    43

    Why Wavelet?

    We require that the wavelet functions, at a minimum,

    satisfy the following:

    0)( dtt

    dtt 2)(

    Wave

    let

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    44/62

    44

    The CWT as a Correlation

    Recall that in the L2space an inner product is defined as

    then

    Cross correlation:

    then

    dttgtftgtf )()()(),(

    )(),(),( , ttxbaW ba

    )(),(

    )()()(

    tytx

    dttytxRxy

    )(

    )(),(),(

    ,,

    0,

    bR

    bttxbaW

    oax

    a

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    45/62

    45

    The CWT as a Correlation

    Meaning of life:

    W(a,b) is the cross correlation of the signal x(t) with themother wavelet at scale a, at the lag of b. If x(t) is similar

    to the mother wavelet at this scale and lag, then W(a,b)

    will be large.

    Filtering Interpretation of

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    46/62

    46

    Filtering Interpretation of

    Wavelet Transform

    Recall that for a given system h[n], y[n]=x[n]*h[n]

    Observe that

    Interpretation:For any given scale a (frequency ~ 1/a), theCWT W(a,b) is the output of the filter with the impulse

    response to the input x(b), i.e., we have a

    continuum of filters, parameterized by the scale factor a.

    dthx

    thtxty

    )()(

    )(*)()(

    )(*)(),( 0, bbxbaW a

    )(0, ba

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    47/62

    47

    What do Wavelets Look Like???

    Mexican Hat Wavelet Haar Wavelet

    Morlet Wavelet

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    48/62

    48

    Constant Q Filtering

    A special property of the filters defined by the motherwavelet is that they areso calledconstant Q filters.

    Q Factor:

    We observe that the filters defined by the mother wavelet

    increase their bandwidth, as the scale is reduced (center

    frequency is increased)

    bandwidth

    frequencycenter

    w (rad/s)

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    49/62

    49

    Constant Q

    f0 2f0 4f0 8f0

    B 2B 4B 8B

    B B B B BB

    f0 2f0 3f0 4f0 5f0 6f0

    STFT

    CWT

    B

    fQ

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    50/62

    50

    Inverse CWT

    a b

    ba dadbtbaWaC

    tx )(),(11

    )( ,2

    dC

    )(

    provided that

    0)( dtt

    Properties of

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    51/62

    51

    Properties of

    Continuous Wavelet Transform

    Linearity

    Translation

    Scaling

    Wavelet shifting

    Wavelet scaling

    Linear combination of wavelets

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    52/62

    52

    Example

    l

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    53/62

    53

    Example

    l

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    54/62

    54

    Example

    Spectrogram &

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    55/62

    55

    Spectrogram &

    Scalogram

    Spectrogramis the square magnitude of the STFT,

    which provides the distribution of the energy of the signal in the time-frequency

    plane.

    Similarly, scalogramis the square magnitude of the CWT, and provides the

    energy distribution of the signal in the time-scale plane:

    2

    20

    2)()(

    )()(

    ),(),(

    t

    ftj

    xxS

    dtetttx

    ftSTFTftSPECP

    2

    2)()(

    )()(

    1

    ),(),(

    t

    xxW

    dta

    bttx

    a

    baCWTbaSCALP

    E

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    56/62

    56

    Energy

    It can be shown that

    which implies that the energy of the signal is the same whether you are

    in the original time domain or the scale-translation space. Compare this

    the Parsevals theorem regarding the Fourier transform.

    xEdttxdbdaa

    baCWT

    2

    2

    2

    )(),(

    CWT in

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    57/62

    57

    CWT in

    Terms of Frequency

    Time-frequency version of the CWT can also be defined, though note that this formis not standard,

    where is the mother wavelet, which itself is a bandpass function centered at t=0 in

    time andf=f0in frequency. That isf0is the center frequency of the mother wavelet.

    The original CWT expression can be obtained simply by using the substitution a=f0/

    f and b=

    In Matlab, you can obtain the pseudo frequency corresponding to any given scale

    by wherefsis the sampling rate and

    Tsis the sampling period.

    dttf

    ftxfffCWT

    t

    x

    0

    0 )(,

    a

    Tf

    fa

    ff so

    s

    o

    Discretization of

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    58/62

    58

    Discretization of

    Time & Scale Parameters

    Recall that, if we use orthonormal basis functions as ourmother wavelets, then we can reconstruct the original

    signal by

    where W(a,b)is the CWT ofx(t)

    Q: Can we discretize the mother wavelet a,b(t)in such a

    way that a finite number of such discrete wavelets can still

    form an orthonormal basis (which in turnallows us to

    reconstruct the original signal)? If yes, how often do we

    need to sample the translation and scale parameters to be

    able to reconstruct the signal?

    A: Yes,but it depends on the choice of the wavelet!

    )(),,()( , tbaWtx ba

    D di G id

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    59/62

    59

    Dyadic Grid

    Note that, we do not have to use a uniform sampling rate

    for the translation parameters, since we do not need as high

    time sampling rate when the scale is high (low frequency).

    Lets consider the following sampling grid:

    log a

    b where ais sampled on a logscale, and b is sampled at a

    higher rate when ais small,

    that is,

    where a0 and b0 are constants,

    and j,kare integers.

    00

    0

    bakbaa

    j

    j

    D di G id

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    60/62

    60

    Dyadic Grid

    If we use this discretization, we obtain,

    A common choice for a0 andb0 are a0 = 2and b0 = 1, which lend

    themselves to dyadic sampling grid

    Then, the discret(ized) wavelet transform (DWT) pair can be given as

    kj

    kj

    d

    dtttxbaW

    ,

    , )()(),(

    a

    bt

    a

    tba 1

    )(,

    002/

    0

    0

    00

    0

    ,

    1)(

    kbtaa

    a

    bkat

    at

    jj

    j

    j

    jkj

    DWT

    j k

    kjkj tdc

    tx )(1

    )( ,,

    Inverse DWT

    Zkjktt jjkj ,22)( 2/,

    N t th t

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    61/62

    61

    Note that

    We have only discretized translation and scale parameters, a and b; time hasnot been discretized yet.

    Sampling steps of bdepend on a. This makes sense, since we do not need as

    many samples at high scales (low frequencies)

    For small a0, say close to 1, and for small b0, say close to zero, we obtain a

    very fine sampling grid, in which case, the reconstruction formula is verysimilar to that of CWT

    For dense sampling, we need not place heavy restriction on (t) to be ablereconstructx(t), whereas sparse sampling puts heavy restrictions on (t).

    It turns out that a0 = 2and b0 = 1 (dyadic / octave sampling)provides a nice

    trade-off. For this selection, many orthonormal basis functions (to be used as

    mother wavelets) are available.

    a b

    ba dadbtbaWaC

    tx )(),(11

    )( ,2

    j k

    kjkj tdc

    tx )(1

    )( ,,

    Di t W l t T f

  • 8/12/2019 Chap 5 - Time Frequency Wavelet

    62/62

    Discrete Wavelet Transform

    We have computed a discretized version of the CWT,

    however, we still cannot implement the given DWT as itincludes a continuous time signal integrated over all times.

    We will later see that the dyadic grid selection will allow

    us to compute a truly discrete wavelet transform of a given

    discrete time signal.