Wavelet Transform

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 76

Wavelet Transform

• Fourier Transform

• Short Time Fourier Transform

• Wavelet Transform

2
How Does FT Work?
• FT uses complex exponentials (sinusoids) as building blocks.
e jt  cost   j sin t 
• For each frequency of complex exponential, the sinusoid at
that frequency is compared to the signal.
• If the signal consists of that frequency, the correlation is high
 large FT coefficients.
 j t 1 j t
F ( )   f (t )e dt f (t )   F ( ) e d
2
• If the signal does not have any spectral component at a
frequency, the correlation at that frequency is low / zero, 
small / zero FT coefficient.

3
FT At Work
Complex exponentials
(sinusoids) as basis
functions:

 j t
X ( j )   x(t )  e dt


1 j t
x(t ) 
2  X ( j )  e dt


4
An ultrasonic A-scan using 1.5 MHz transducer, sampled at 10 MHz
FT At Work

x1 (t )  cos(2  5  t )

x2 (t )  cos(2  25  t )

x3 (t )  cos(2  50  t )

5
FT At Work

x1 (t ) F X 1 ( )

x2 (t ) F X 2 ( )

x3 (t ) F X 3 ( )

6
FT At Work

x4 (t )  cos(2  5  t )
 cos(2  25  t )
 cos(2  50  t )

x4 (t ) F X 4 ( )

7
Stationary and Non-stationary Signals
• FT identifies all spectral components present in the signal, however it
does not provide any information regarding the temporal (time)
localization of these components. Why?
• Stationary signals consist of spectral components that do not change
in time
– 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 spectral
components
– How do we find out which spectral component appears when?
– FT only provides what spectral components exist , not where in
time they are located.
– Need some other ways to determine time localization of
spectral components 8
Stationary and Non-stationary Signals

• Stationary signals’ spectral characteristics do not change with time

x4 (t )  cos(2  5  t )
 cos(2  25  t )
 cos(2  50  t )
• Non-stationary signals
have time varying spectra
x5 (t )  [ x1  x2  x3 ]

 Concatenation

9
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

10
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 the
entire 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 ?

11
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
12
STFT

13
STFT
Time Frequency Signal to
parameter FT Kernel
parameter be analyzed (basis function)

STFT (, )   x ( t )  W ( t  ) e



x
 j t
dt
t

STFT of signal x(t): Windowing Windowing function


Computed for each function centered at t = 
window centered at t = 
14
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
Time Signal to
Frequency FT Kernel
parameter be analyzed
parameter (basis function)

STFTx ( ,  )   x (t )  W (t   )  e  j t
dt
t
STFT of signal x(t): Windowing
Computed for each function Windowing function
window centered at t =  (Analysis window) centered at t =  15

(localized spectrum)
16
17
Time-Frequency Resolution
• Closely related to the choice of analysis window
– Narrow window  good time resolution
– Wide window (narrow band)  good frequency resolution
• Two extreme cases:
 (T)=(t) excellent time resolution, no frequency
resolution
 (T)=1 excellent freq. resolution (FT), no time info!!!
– How to choose the window length?
• Window length defines the time and frequency resolutions
• Heisenberg’s inequality
– Cannot have arbitrarily good time and frequency
resolutions. One must trade one for the other.
18
Frequency
STFT - Time-Frequency Resolution

Time
19
STFT Example

 at 2 / 2
 (t )  e 20
STFT Example

a=0.01 21
STFT Example

a=0.001 22
STFT Example

a=0.0001 23
STFT Example

a=0.00001 24
Time – Frequency Resolution
• Time – frequency resolution problem with STFT
– Analysis window dictates both time and frequency
resolutions, once and for all
– Narrow window  Good time resolution
– Narrow band (wide window)  Good frequency
resolution
• When do we need good time resolution, when do
we need good frequency resolution?

25
Heisenberg Principle

Time resolution: How well two Frequency resolution: How


spikes in time can be separated well two spectral components
from each other in the transform can be separated from each other
domain in the time 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 26
The Wavelet Transform
• Overcomes the preset resolution problem of the STFT by using a
variable length window
• Analysis windows of different lengths are used for different
frequencies:
– Analysis of high frequencies Use narrower windows for better
time resolution
– Analysis of low frequencies  Use wider windows for better
frequency resolution
• This works well, if the signal to be analyzed mainly consists of slowly
varying characteristics with occasional short high frequency bursts.
• Heisenberg principle still holds!!!
• The function used to window the signal is called the wavelet
27
The Wavelet Transform

Translation parameter, Scale parameter, A normalization


measure of time constant Signal to be
measure of frequency
analyzed

  1  t  
CWTx ( , s )  x ( , s ) 
s t
 xt   dt
 s 

Continuous wavelet transform The mother wavelet. All kernels are


of the signal x(t) using the obtained by translating (shifting) and/or
analysis wavelet (.) scaling the mother wavelet

Scale = 1/frequency
28
WT at Work
High frequency (small scale)

Low frequency (large scale)

29
Scale & Translation
• Translation  time shift
• f(t) f(at) a>0
– If 0<a<1 dilation, expansion  lower frequency
– If a>1  contraction  higher frequency
• f(t)f(t/a) a>0
– If 0<a<1  contraction  low scale (high frequency)
– If a>1  dilation, expansion  large scale (lower
frequency)
• Scaling  Similar meaning of scale in maps
– Large scale: Overall view, long term behavior
– Small scale: Detail view, local behavior

30
1
1:44,500,000 scale  1:2,500,000

frequency

31
1:375,500 1:62,500
The Mother of All Oscillatory Little Basis Functions

• The kernel functions used in Wavelet transform are all obtained


from one prototype function, by scaling and translating the
prototype function.
• This prototype is called the mother wavelet
Translation
1 t b
 a,b (t )  ( ) parameter
a a
Scale parameter
1 Normalization factor to ensure that all
wavelets have the same energy
a
  
 1,0 (t )   (t )
2 2
 (t ) dt    (1,0 ) (t ) dt    (t ) dt
2
( a ,b )
  
32
Continuous Wavelet Transform

Mother wavelet translation


( ) 1  t  b 
CWTx (a, b)  W (a, b) 
a  
x(t )   dt
 a 

Normalization factor Scaling:


CWT of x(t) at scale
Changes the support of
a and translation b
the wavelet based on the
Note: low scale  high frequency
scale (frequency)

33
ECG Waveform (Normal)

34
Amplitude Computation of CWT

Amplitude
W (1  b0 ) W (10  b0 ) W (10  bN )

b0 bN time b0 bN time
W (1  bN )
Amplitude

Amplitude
W (5  b0 ) W ( 25  b0 ) W ( 25  bN )
W (5  bN )

b0 bN time b0 bN time

1  t  b 
CWTx( ) ( a, b)
a 
 W ( a, b)  x (t )   dt 35
 a 
• We require that the wavelet functions, at a
minimum, satisfy the following:
 Wave…

 (t )dt  0


2
  (t )
…let
dt  

36
The CWT as a Correlation
• Recall that in the L2 space an inner product is defined as

 f (t ), g (t )   f (t ) g  (t )dt

then W (a, b)  x(t ), a,b (t ) 

Rxy ( )   x(t )  y  (t   )dt


Cross correlation:
 x(t ), y (t   ) 

W (a, b)  x(t ), a,0 (t  b) 


then
 Rx, a ,o (b)
37
The CWT as a Correlation

W(a,b) is the cross correlation of the signal


x(t) with the mother 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.

38
Examples

39
40
41
42
43
44
Frequenc
y
What Is Wavelet Analysis ?
• And…what is a wavelet…?

• A wavelet is a waveform of effectively limited


duration that has an average value of zero.
45
Wavelets Vs. Sine Waves
Sine waves Wavelets
Average value of zero Average value of zero

Infinite in time Limited time duration

Symmetric Asymmetric/symmetric

Smooth Irregular

46
Wavelet Analysis Vs. Fourier Analysis
• Fourier analysis:
Consists of breaking up a signal into sine
waves of various frequencies.

• Wavelet analysis:
Consists of breaking up a signal into shifted
and scaled version of the original wavelet.
(called: mother wavelet)
47
Number Of Dimensions
• Like the Fourier analysis, the wavelet analysis
can also be applied to two-dimensional data
(such as images) or higher dimensions, and
preserve its unique features.

48
The Continuous Wavelet Transform
• A mathematical representation of the Fourier
transform:

z

 j t
F ( )  f ( t )e dt


• Meaning: the integral over all time of the


signal f(t) multiplied by a complex
exponential, and the result is the Fourier
coefficients F() .
49
Wavelet Transform (Cont’d)
• Those coefficients, when multiplied by a
sinusoid of appropriate frequency , yield
the constituent sinusoidal component of the
original signal:

50
Wavelet Transform (Cont’d)
• Similarly, the continuous wavelet transform
(CWT) is defined as the integral over all time
of the signal, multiplied by scaled and shifted
versions of the wavelet function :

z

C ( scale , postion )  f (t )  ( scale , position , t ) dt



51
Wavelet Transform (Cont’d)
• And the result of the CWT are wavelet
coefficients .
• Multiplying each coefficient by the
appropriately scaled and shifted wavelet yields
the constituent wavelet of the original signal:

52
Scaling
• Wavelet analysis produces a time-scale
view of the signal.
• Scaling means stretching or compressing of
the signal.
• Scale factor (a) for sine waves:

f ( t )  sin(t ) ; a  1
f ( t )  sin(2t ) ; a  1 2

f ( t )  sin(4t ) ; a  1 4
53
Scaling (Cont’d)
• Scale factor works exactly the same with
wavelets:

f ( t )  (t ) ; a  1
f ( t )   ( 2t ) ; a  1 2
f ( t )   ( 4t ) ; a  1 4
54
Scaling Factor
• For sinusoid, sin( t) the scale factor a is
inversely related to the radian frequency 

• For wavelets, the scale factor a is inversely


related to the frequency.

55
Shifting
• Shifting means to delaying or hastening its
starting point.
f(t-k) is f(t) delayed by k :

Wavelet function Shifted Wavelet function


(t) (t-k)
56
CWT: The Process
• Reminder: The CWT is the integral over all
time of the signal, multiplied by scaled and
shifted versions of the wavelet function 

• 5 steps process to be taken:

Step 1:
Take a Wavelet and compare
it to a section at the start
of the original signal
57
CWT: The Process (Cont’d)
Step 2:
Calculate a number, C, that represents
how closely correlated the wavelet is
with this section of the signal. The
higher C is, the more the similarity.

Note: The results will


depend on the shape of
the wavelet you choose 58!
CWT: The Process (Cont’d)
• Step 3: shift the wavelet to the right and
repeat steps 1-2 until you’ve covered the
whole signal

59
CWT: The Process (Cont’d)
• Step 4: scale (stretch) the wavelet and
repeat steps 1-3

60
CWT: The Process (Cont’d)
• Step 5: repeat steps 1-4 for all scales...

61
And When You Are Done...
• You’ll get the coefficients produced at different
scales by different sections of the signal:

62
Scale And Frequency
• In the former example, the “scale” run from
1 to 31, when higher scale correspond to
the most “stretched” wavelet.
• The more stretched the wavelet - the longer
the portion of the signal with which it is
being compared, and thus, the coarser the
signal features being measured by the
wavelet coefficient.

Low scale High scale 63


Scale And Frequency (Cont’d)
• Low scale a : compressed wavelet :fine details
(rapidly changing) : high frequency

• High scale a : stretched wavelet: coarse


details (slowly changing): low frequency

64
Why Scale ?
• Time-scale is a different way to view data…
but it is more than that !

Time-Scale is a very natural way to view data


deriving from a great number of natural
phenomena !

65
The main advantage: Local analysis
• Local analysis: to analyze a localized area of
a larger signal
• Eg. : Discontinuity caused by a noisy switch

66
Local Analysis (Cont’d)
Wavelet analysis

In the Wavelet plot we can clearly see the exact location


in time of the discontinuity. 67
A “Continuous” Transform?
The CWT is continuous in 2 means:
• It can operate at every scale, up to some
maximum scale you determine (trade off
between detailed analysis and CPU time…).
• During analysis the wavelet is shifted
smoothly over the analyzed function.

68
Shift Smoothly Over The
Analyzed Function

69
Continuous versus
Discrete Wavelet transform

CWT is a function of two parameters and therefore contains a high


amount of extra (redundant) information when analyzing a function.

Instead of continuously varying the parameters, we analyze the


signal with a small number of scales with varying number of
translations at each scale. This is the discrete wavelet transform.

Although Discrete wavelet transform may be derived without referring


to CWT, we may view it as a “discretization” of the CWT through
sampling specific wavelet coefficients.

70
71
• In CWT, we find wavelet coefficients for every(a,b)
combination.

• In Discrete wavelet transform we find wavelet


coefficients only at very few points denoted by the dots
and the wavelets that follow these values are given by

72
73
74
75
References
1. M. Vetterli, J. Kovacevic, “Wavelets and subband coding" Prentice Hall
Inc, 1995
2. J.C. Goswami and A. K. Chan, “Fundamentals of wavelets: Theory,
Algorithms and Applications" Wiley-Interscience Publication, John Wiley
& Sons Inc., 1999.
3. R. M. Rao and A. Bopardikar, “Wavelet transforms: Introduction to
theory and applications" Addison-Wesley, 1998.
4. Wavelet Tutorial : Parts I to IV, by Robi Polikar, Iowa State Unty.
5. K.P. Soman, An insight into Wavelets

76

You might also like