You are on page 1of 45

WAVELET METHODS FOR TIME SERIES ANALYSIS

Curso: ANLISIS DE SISTEMAS DINMICOS NO LINEALES: APLICACIN A LOS SISTEMAS NATURALES

Prof. JOSE FCO. GOMEZ GLEZ. jfcgomez@ull.es.

1. Introduction
The first recorded mention of what we now call a wavelet seems to be in 1909 in a thesis by Alfred Haar. The concept of wavelets in its present theoretical form was first proposed by Jean Morlet and the team at the Marseille Theoretical Physics Center working under Alex Grossmann in France. The concept of wavelet analysis have been developed mainly by Y. Mayer and his colleagues. The main algorithm dates back to the work of Stephane Mallat in 1988. Such research is particularly active in the United States, where it is spearheaded by the work of scientists such as Ingrid Daubechies, Ronald Coifman, and Victor Wichkerhauser. Wavelets are a relatively new way of analyzing time series or images. Wavelet analysis is in some cases complementary to existing analysis techniques (e.g., correlation and spectral analysis) and in other cases capable of solving problems for which little progress had been made prior to the introduction of wavelets.

2. Summary of Fourier Theory

3. Why Wavelet analysis?


The results of the Fourier transform are the Fourier coefficients A(f), which when are multiplied by a sinusoid of frequency f yield the constituent sinusoidal components of the original signal.

To study Non-stationary Signals, in which their frequency components are changing over time, we cannot use the Fourier Transform because time information is lost. To correct this deficiency, Gabor (1946) adapted the Fourier Transform to analyze only a small section of the signal at a time. Gabors adaptation, called Short-Time Fourier Transform (STFT) maps a signal into a two-dimensional function of time and frequency.

The STFT represents a sort of compromise between the time- and frequency-based views of a signal. It provides some information about both when and at what frequencies a signal event occurs. However, you can only obtain this information with limited precision, and that precision is determined by the size of the window. Real signals, in the nature, have their principal frequencies in the lowfrequency region. Therefore, it is totally necessary to have higher accuracy in this region. Therefore, wavelet analysis represents the next logical step: a windowing technique with variable-sized regions. Wavelet analysis allows the use of long time intervals where we want more precise low-frequency information, and shorter regions where we want high-frequency information.

4. The essence of a wavelet


a wavelet is a small wave. A wavelet grows and decays essentially in a limited time period. To quantify the notion of a wavelet, let us consider a real-valued function () defined over the real axis (-, +) and satisfying two basic properties: The integral of () is zero:

The square of () integrates to unity:

Haar wavelet function (this is the oldest wavelet)

To form the next wavelets, we start with the Gaussian probability density function for random variable with mean zero and variance 2

The first derivative of

()

is

If we renormalize the negative of the above to satisfy Equation 2, we obtain

the wavelet.

With proper renormalization again, the negative of the second derivative of also yields a wavelet, usually referred to as the Mexican hat:

()

5. The Essence of Wavelet Analysis


let x() be a real-valued function of an independent variable t, that we will refer to as time. Let us consider the integral

Where (a,b) is called the average value of x() over the interval [a, b]

Instead of regarding an average value (a,b) as a function of the end points of the interval [a,b] over which the integration is carried out, we can just as easily consider it to be a function of the length of the interval, i.e. =b-a, and the center time of the interval, i.e. t=(a+b)/2. We refer to as the scale associated with the average. Using and t, we can define

We call A(,t) the average value of the signal x() over a scale of centered about time t

As a specific example consider a series of measurements related to how well a particular cesium beam atomic clock (clock 571) keeps time on a daily basis as compared to a master clock. The measurements are daily average fractional frequency deviates. They can be regarded as averages of a signal x() over intervals of the form

[t 12 , t + 12 ]

When A(1,t)<0 then clock 571 has lost time.

A good indicator of the inherent ability of clock 571 to keep good time over a scale of a day is thus not A(1,t) itself, but rather how much A(1,t) changes from one time period to another.

Or

if |D(1,t)| is close to zero, the daily performance of the clock is good. More generally, the timekeeping abilities of a clock over a scale can be judged by examining

(3)

scale

We are now in a position to connect wavelets to the scheme of looking at changes in averages. Because the two integrals in Equation (3) involve adjacent non-overlapping intervals, it is easy to combine then into a single integral over the entire real axis to obtain

Specializing to the case =1 and t=0 yields

Haar wavelet

The Haar wavelet extracts information about how much difference there is between the two unit scale averages of x() bordering on time t=0

To adjust the Haar wavelet to extract information about unit scale changes at other values of t

To shift the location of H(.)

To extract similar information about other scales and times t

It is proportional to the difference between two adjacent averages of scale , the first average beginning at time t, and the second, ending at time t.

The collection of variables

{W ( , t ) : > 0, < t < }


H

is known as the HAAR CONTINUOUS WAVELET TRANSFORM (CWT) of x(.)

We now state a fundamental fact about the CWT that it preserves all the information in x if satisfies the admissibility condition of

()

()

and

Then we can recover

x()

from its CWT via

6. Five easy steps to a CWT


The CWT produces wavelet coefficients that are a function of scale and position of the wavelet. Multiplying each coefficient by the appropriately scale and shifted wavelet yields the constituent wavelet of the original signal.

Scaling a wavelet simply means stretching or compressing it. The scale factor, , works how following: The smaller the scale factor, the more compressed the wavelet. t It is clear that the scale factor is related inversely to the radian frequency of the signal.

=1

=1/2

=1/4

Shitfting a wavelet simply means delaying or hastening its onset

Therefore, the CWT is

Its a very simple process. In fact, here are the five steps of an easy recipe for creating a CWT: 1) Take a wavelet and compare it to a section at the start of the original signal 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. More precisely, if the signal energy and the wavelet energy are equal to one, C may be interpreted as a correlation coefficient. Note that the results will depend on the shape of the wavelet you choose. 3) Shift the wavelet to the right and repeat step1 and 2 until you are covered the whole signal. 4) Scale (stretch) the wavelet and repeat step1 through 3. 5) Repeat steps 1 through 4 for all scales.
When you are done, you will have the coefficients produced at different scales by different sections of the signal. The coefficients constitute the results of a repression of the original signal performed on the wavelets. How to make sense of all theses coefficients? You could make a plot on which the x-axis represents position along the signal (time), the y-axis represents scale, and the colour at each x-y point represents the magnitude of the wavelet coefficient C.

W ( , t ) = ,t (u )x(u )du where , t (u ) =

u t ( )

7. The Discrete Wavelet Transform


The Discrete Wavelet Transform (DWT) of {Xt} is an orthonormal transform. The series and its transform can be considered to be two representations of the same mathematical entity.
An N x N real-valued matrix is said to be orthonormal if its transpose is its inverse, i.e. if T = IN where IN is the N x N identity matrix. We can decompose a time series X by premultiplying it by to obtain W= X an N dimensional column vector containing the transform coefficients; likewise, given O, we can reconstruct X since X=T W The orthonormality implies that ||W||2=||X||2. Hence W n2 represents the contribution to the energy attributable to the DWT coefficient with index n.

WT

Let us now define exactly what the notion of scale means. For a positive integer , let

Represents the average of the contiguous data values note that

X t (1) = X t
, which we can regard as a single point average and

X N 1 (N ) = X
which is the sample average of all N values

Note that the first eight DWT coefficients W0,,W7 are proportional to differences in adjacent averages of {Xt} on a unit scale; the next four W8,,W11 are differences in adjacent averages on a scale of two W12 and W13 are proportional to differences on a scale of four; W14 is proportional to a difference on a scale of eight; and the final coefficient W15 is proportional to the average of all the data. There are thus exactly N/(2i) coefficients in the DWT associated with changes on scale i where i=2j-1 for j=1,,J (note 1=1 and J=N/2); additionally, there is one coefficient WN-1 associated with an average at scale N. The N-1 coefficients that are associated with changes on various scales are called wavelet coefficients, whereas WN-1 is called a scaling coefficient.

Let us now decompose the elements of the vector W into J+1 subvectors. The first J subvectors are denoted by Wj j=1,J and the jth such a subvector contains al of the DWT coefficients for scale j. Note that Wj is a column vector with N/2j elements. The final subvector is denoted as VJ and contains just the scaling coefficient WN-1. We can write When J=4, N=2J=16

Let us now consider the wavelet synthesis of X

Recall that we have defined For

T which S J = , J VJ is a vector whose elements are all

0 j J let 1
Details (Low-scale, Highfrequency components)

Sj is a smoothed version of X

Sj =

D
k = j +1

+ SJ

Approximations (High-scale, Low-frequency components)

Wavelet transform algorithm

Wavelet filter

Scaling filter is defined in terms of the wavelet filter via the quadrature mirror relationship

The signal S analyzed at level j has the following structure:

Some exaples of Wavelets Families


a) Haar.

b) Daubechies.

c) Biorthogonal.

Scale to frequency:
Pseudo-frequencies corresponding to the scales

Wavelet Toolbox of Matlab

One-Dimensional Analysis Using the Command Line of Wavelet Toolbox of Matlab

Approximation coefficients at level 3 (cA3)

Details coefficients at level 3 (cD3)

Details coefficients at level 2 (cD2)

Details coefficients at level 1 (cD1)

The Continuous Fourier Transform & Amperometric Record


1.0

3.0 2.5

0.5

2.0
0.0

V 1.5 1.0 0.5


-1.0 0 10 20 30 40 -3 x10 50 60 -0.5

2 s

50 seno Freq Response 0


40 60V

Data Freq Response

-50 dB
dB 0 -20 -40

-100 -150 -200 -250 0 200 400 Hz 600 800

20

500

1000 Hz

1500

2000

WT & Amperometric Record


2
2

1 0 2

S
a6

1 0
2 1 0

a6
d6

1 0

d5

d4

d3

d2

d2
0.5
0.5

d1

d1

d3
0.0 -0.5
0.0 -0.5

d4
0

d5

d6

10

15

20

10

15

20

Tiempo (s)

Tiempo (s)

WT & Amperometric Record


Scale Scale

Shift (time)