Vous êtes sur la page 1sur 10

Int. J. Elect. Enging. Educ., Vol. 36, pp. 255–264. Manchester U.P., 1999.

Printed in Great Britain

DISCRETE WAVELET ANALYSIS OF SIGNALS

F. ASAMOAH
Department of Electrical and Computer Engineering, University of the West
Indies, T rinidad. E-mail: fasamoah@eng.uwi.tt

ABSTRACT A discrete wavelet transform based on Daubechies coefficients is used to decompose


a signal into levels. The method discussed is applicable to any signal of length 2N. Where the length
is less than 2N it is zero-padded to obtain the required length. A program written in MATLAB is
used for the computations.

KEYWORDS decomposition; dilation; levels; reconstruction; wavelets

1 INTRODUCTION
Signal analysis has traditionally been studied by Fourier methods. However,
in recent times another concept has emerged which is increasingly being used
as an alternative to the Fourier approach; this new method is based on wavelets.
A wavelet is a wave of very short duration which has its energy concentrated
in time. Wavelet analysis is more efficient particularly where the signal being
analyzed has transients or discontinuities. Wavelet analysis is increasingly being
applied in diverse fields, including medicine and biology, geophysical signal
processing and numerical methods1–3. This paper discusses a simple decompo-
sition and reconstruction of a given discrete signal using Mallat’s algorithm4.
The field of wavelets is still being researched in universities, colleges and
industry. However, it is increasingly being taught in graduate and undergrad-
uate courses in mathematics digital signal processing and communications. The
Electrical and Computer Engineering Department of The University of the
West Indies has begun a course with final year undergraduate projects in
wavelet-based analysis of electroencephalograms (EEG) and speech waveforms.
We hope to start teaching the basics as part of the discrete signal processing
course from the next academic year. The paper presents an easy-to-implement
program (available on request) for the analysis of any one-dimensional signal.

2 DILATION AND WAVELET EQUATIONS (Ref. 5)


The data considered in the following derivations is assumed to be of finite
duration and of length 2N, where N is an integer. (Where the number is less
than 2N the data is zero-padded to bring the total to the required length.)
The basis of the wavelet is the dilation equation that links a scaling function

255

Downloaded from ije.sagepub.com at UNIV PRINCE EDWARD ISLAND on July 5, 2015


256

Q(x) and its translates Q(2x). This is given by:


L−1
Q(x)= ∑ c Q(2x−k) (1)
k
k=0
where L is an even number.
Corresponding to the dilation equation is the wavelet equation given by
L−1
W (x)= ∑ (−1)kc Q[2x+k−(L −1)] (2)
k
k=0
One way of solving the dilation equation is by numerical methods using
iteration of the scaling equation
L−1
Q (x)= ∑ (−1)kc Q (2x−k) (3)
i k i−1
k=0
until Q $Q .
i−1 i
The initial value of Q(x), Q (x), is assumed to be the unit box function, i.e.
0

H
1 0≤x≤1
Q (x)= (4)
0 0 x>1
The numerical values of c may be computed using the properties of the scaling
k
function. These values are available in the literature5,6. These coefficients are
used in the subsequent derivations. In particular, we shall use Daubechies
coefficients of order 8, D8 in the computations which follow. This is without
loss of generality. These are given below:

D8 coeYcients
c =0.325803428051 c =1.010945715092
0 1
c =0.892200132846 c =−0.039575026236
2 3 (5)
c =−0.264507167369 c =0.043616300475
4 5
c =0.046503601071 c =−0.014986989330
6 7
The D8 wavelet is shown in Fig. 1.

FIG. 1 Daubechies wavelet, N=8.

Downloaded from ije.sagepub.com at UNIV PRINCE EDWARD ISLAND on July 5, 2015


257

3 SIGNAL DECOMPOSITION
One of the main applications of wavelets is the decomposition of a signal into
levels or scales. (This is similar to the decomposition of a signal into its Fourier
components or harmonics.) The number of levels depends on the length of the
signal. A signal with 2N values is decomposed into (N+1) levels.
Let the signal be denoted by g(x). Then the decomposed signal is given by
3
g(x)=a Q(x)+a W (2x)+ ∑ a W [2x−(i−2)]
0 1 i
i=2
7 2N−1−1
+ ∑ a W [4x−(i−4)]+ ··· + ∑ a W [2N−1x−(i−2N−1)] (6)
i i
i=4 i=2N−1
i.e.
g(x)=g (x)+g (x)+g (x)+ ··· +g (x) (7)
1 2 3 N+1
where g (x), i=1, 2, ..., N+1 represents the decomposed signal at the ith level.
i
The coefficients, a , are calculated using Mallat’s algorithm4.
i

4 TRANSFORMATION MATRICES
The calculation of the coefficients a requires the transformation matrices L
i i
and H , i=1, 2, ..., N, where the dimensions of L and H are (2i−1×2i). L and
i i i
H are formed from the low-pass and high-pass Daubechies filter coefficients
respectively.
Let
c=[c c c c c c c c ] (8)
0 1 2 3 4 5 6 7
The elements of the first row of L are the same as the elements of c in the
i
same order as given in (8). Whenever the coefficients spill over the number of
columns of L the remaining elements are wrapped around and the terms in
i
the same column are added. If the length of the column is greater than columns
of c, the elements in the remaining columns are all zero.
A subsequent row is obtained from the previous row by shifting the elements
two columns to the right (equivalent to down-sampling). Wrap-around is
applied whenever necessary.

Example
L =[c +c +c +c c +c +c +c ] (9)
1 0 2 4 6 1 3 5 7

C D
c +c c +c c +c c +c
L = 0 4 1 5 2 6 3 7 (10)
2 c +c c +c c +c c +c
2 6 3 7 0 4 1 5
As the dimensions of L increase it becomes impractical to write down the
i
matrix as done above. However, a simple computer program can be written to
form the required matrix. As an example, consider the formation of L which
10

Downloaded from ije.sagepub.com at UNIV PRINCE EDWARD ISLAND on July 5, 2015


258

has dimensions of (29×210), i.e. 512×1024. The program is written in


MATLAB but any other suitable language may be used:

L10=zeros(512,1024);
c=[c0 c1 c2 c3 c4 c5 c6 c7];
for k=1:509
L10(k,2*k−1:2*k+6)=c;
end
for k=1:3
L10(k+509,2*k+1017:1024)=c(1:8−2*k);
L10(k+509,1:2*k)=c(9−2*k:8);
end

4.1 Formation of the H matrices


The formation of H follows a similar procedure, but using the high-pass filter
i
coefficients. Let d denote the row vector of the high-pass filter coefficients.
Then

d=[−c c −c c −c c −c c ] (11)
7 6 5 4 3 2 1 0
Each H is exactly the same as the corresponding L but with each element c(i)
i i
replaced by d(i).

Example

H =[d +d +d +d d +d +d +d ] (12)
1 0 2 4 6 1 3 5 7

5 COMPUTATION OF WAVELET COEFFICIENTS


A signal of 2N values has 2N wavelet coefficients. Let this be denoted by a
vector a, where

a=[a(1) a(2) ··· a(2N)]T (13)

Let H =[1], and


0
A =H L L ··· L
0 0 1 2 N
A =H L L ··· L
1 1 2 3 N
e (14)
A =H L
N−1 N−1 N
A =H
N N

Downloaded from ije.sagepub.com at UNIV PRINCE EDWARD ISLAND on July 5, 2015


259

This can be written in compact form as

A B
N
A =H a L , k=0, 1, 2, ..., N−1
k k i (15)
i=k+1
H =A , H =1
N N 0
The wavelet coefficients are computed as follows:

a(1)=(1/2N)A y
0
a(2)=(1/2N)A y
1
[a(3) a(4)]T=(1/2N−1)A y
2 (16)
e
[(a(2N−3+1) ··· a(2N−2)]T=(1 )A y
4 N−1
[a(2N−2+1) ··· a(2N)]T=(1 )A y
2 N
This can also be written in compact form, as shown below.
Define the (2N×2N) matrix G as

CD
A
0
A
1
G= e (17)
A
N−1
A
N

and the (2N) diagonal matrix D as

D(1, 1)=2−N, D(2,2)=2−N, D( j, j )=2−(N+2−i)


(18)
(i=3, 4, ..., N+1) ( j=2I−2+1, 2I−2+2, ..., 2I−1)

Then

a=DGy (19)

where y is the (2N×1) vector of the signal.

5.1 Signal decomposition


A signal of length 2N can be decomposed to N+1 levels. These levels are
computed making use of the wavelet coefficients obtained in (16).
Let the levels be denoted by ( y , y , ..., y ).
1 2 N+1

Downloaded from ije.sagepub.com at UNIV PRINCE EDWARD ISLAND on July 5, 2015


260

Then

y =(A )Ta(1)
1 0
y =(A )Ta(2)
2 1

C D
a(3)
y =(A )T
3 2 a(4)
(20)
e

C D
a(2N−1+1)
y =(A )T e
n+1 N
a(2N)

This can also be expressed as matrix multiplication in what follows:


Let F be a [(N+1)×2N] matrix, defined as

F(1, 1)=1; F(2, 2)=1;


F(i, j )=1; i=3, 4, ..., N+1, j=2i−2+1, 2i−2+2, ..., 2i−1;
F(i, j )=0; elsewhere.

Let P be a (2N×2N) diagonal matrix where

P(i, i)=a(i) (21)

Then the (N+1) levels of the decomposed signal are given by the [(N+1)×2N]
matrix U, where

U=FPG (22)

Row 1 of U gives level 1 of the decomposed signal, row 2, level 2, etc. Let V
be a [1×(N+1)] row vector, and Y, the reconstructed signal. Then Y is given
by

Y =V U (23)

A desired approximation of the signal can be made by replacing some of the


wavelet coefficients below a threshold value with zeros (0).
Equation (21) still holds and the approximated signal is once more obtained
from equation (23).

6 EXAMPLE
Fig. 2 is a 512 (=29) data represented as a triangular waveform. The above
derivations and equations were implemented using MATLAB. Fig. 3 shows the
ten levels of the decomposed signal. Fig. 4 is the reconstructed signal, obtained
by adding all ten levels. A 3-dimensional plot of the matrix U is shown in

Downloaded from ije.sagepub.com at UNIV PRINCE EDWARD ISLAND on July 5, 2015


261

FIG. 2 T riangular waveform.

(a) (b) (c)

(d) (e) (f)

(g) (h) (i)

(j)

FIG. 3 Decomposed signals: (a) level 1; (b) level 2; (c) level 3; (d) level 4;
(e) level 5; (f) level 6; (g) level 7; (h) level 8; (i) level 9; (j) level 10.

Downloaded from ije.sagepub.com at UNIV PRINCE EDWARD ISLAND on July 5, 2015


262

FIG. 4 Reconstructed waveform.

Fig. 5. This shows the relative contributions of all the levels. It can be seen
that the contributions from levels 8, 9, and 10 are insignificant; Fig. 6 is the
approximate reconstructed signal, neglecting these levels. Fig. 7 shows levels 8,
9, and 10 plotted with the vertical axis expanded. The transition points are
clearly shown in these plots. This property of wavelets can be used in appli-
cations such as edge detection, and determination of regions of sudden changes
in a set of data.

FIG. 5 T hree-dimensional plot, all levels.

FIG. 6 Approximate reconstructed signal: levels 1 to 7.

Downloaded from ije.sagepub.com at UNIV PRINCE EDWARD ISLAND on July 5, 2015


263

(a) (b) (c)

FIG. 7 Expanded y-axis for (a) level 8; (b) level 9; (c) level 10.

7 CONCLUSIONS
Matrix equations have been derived for the wavelet coefficients of a signal of
length 2N. The levels of the decomposed signal have also been expressed as a
simple matrix equation. These two equations can be applied to any signal of
length 2N. Once the signal wavelet coefficients have been obtained, applications
such as approximation, denoising, etc. can be implemented.
In the example given, it can be seen that the waveform can be reconstructed
to give a reasonable approximation by summing levels 1 to 7 only. Thus the
approximate signal is obtained by using only 64 out of the 512 wavelet
coefficients. If this signal were to be transmitted, it implies that the total
transmission time would be one-eighth (1/8) of the time required compared
with the transmission of the original 512-point data. The signal would then be
reconstructed at the receiving end by using the reconstruction equation.
A more realistic case is where the coefficients to be transmitted are located
randomly. In such a situation two sets of numbers would have to be transmitted:
the value of the actual coefficient, and an integer value giving its position. The
coefficients are then placed at their exact locations to form the matrix P at the
receiving end. The received signal would then be reconstructed from equa-
tion (22) but now all the (N+1) rows are added together.
The approach discussed in this paper can be extended to two-dimensional
data such as images with slight modifications. This would be similar to the
extension of one-dimensional FFT to two-dimensional FFT.

REFERENCES
[1] Rioul, O. and Vetterli, M., ‘Wavelets and signal processing’, IEEE Spectrum, 10, pp. 14–38
(1991)
[2] Bruce, M., Donoho, D. and Gao, H.-Y., ‘Wavelet analysis’, IEEE Spectrum, 10, pp. 26–35
(1996)
[3] Akay, M., ‘Wavelet applications in medicine’, IEEE Spectrum, 5, pp. 50–56 (1997)
[4] Mallat, S., ‘A theory of multiresolution signal decomposition, the wavelet representation’,
IEEE T rans. Pattern Anal. Machine Intelligence, 11, pp. 674–93 (1989)
[5] Newland, D. E., An Introduction to Random V ibrations, Spectral and Wavelet Analysis, John
Wiley, Ch. 17, pp. 295–339 (1994)
[6] Daubechies, I., ‘Orthonormal bases of compactly supported wavelets’, Comm. Pure Appl.
Maths, 41, pp. 909–996 (1988)

Downloaded from ije.sagepub.com at UNIV PRINCE EDWARD ISLAND on July 5, 2015


264

ABSTRACTS — FRENCH, GERMAN, SPANISH

Analyse par ondelettes discrètes de signaux


Une transformée en ondelettes discrètes basée sur les coefficients de Daubechies est utilisée pour
décomposer un signal en niveaux. La méthode discutée est applicable à tout signal de longueur
2N. Lorsque sa longueur est inférieure à 2N il est complété par des zéros pour obtenir la longueur
requise. Un programme écrit en MATLAB est utilisé pour les calculs.

Diskrete Wellenlängenanalyse von Signalen


Eine diskrete Wellentransformierte auf Daubechies Koeffzientenbasis wird verwendet, um ein
Signal in Pegel zu zerlegen. Die diskutierte Methode ist auf jedes Signal von der Länge 2N
anwendbar. Wo die Länge weniger als 2N beträgt, wird sie mit Null aufgefüllt, um die erforderliche
Länge zu erhalten. Für die Berechnungen wird ein in MATLAB geschriebenes Programm
verwendet.

Análisis de señales de onda discretas


Se emplea una transformación de onda discreta basada en los coeficientes de Daubechies para
descomponer una señal en niveles. El método discutido es aplicable a cualquier señal de longitud
2N. Cuando la longitud es menor que 2N, es rellenada de ceros para obtener la longitud requerida.
Para los cálculos se utiliza un programa escrito en MATLAB.

Downloaded from ije.sagepub.com at UNIV PRINCE EDWARD ISLAND on July 5, 2015

Vous aimerez peut-être aussi