You are on page 1of 58

A

PROJECT REPORT

ON

ECG SIGNAL DENOISIG USING WAVELET TRANSFORM

1
SYNOPSIS

When doctors are examining a patient and want to review the electrocardiogram of the
patient, there is a good chance that ECG signal has been contaminated by 50Hz noise. To allow
doctors to view the best signal that can be obtained, we need to develop wavelet transform to
remove contaminating signal in order to better obtain and interpret the ECG data. Studies shows
that Electrocardiogram (ECG) computer programs perform at least equally well as human
observers in ECG measurement and coding, and can replace the cardiologist in epidemiological
studies and clinical trials. However, in order to also replace the cardiologist in clinical settings,
such as for out–patients, better systems are required in order to reduce ambient noise while
maintaining signal sensitivity. Therefore the objective of this work was to develop an wavelet
transform to remove the contaminating signal in order to better obtain and interpret the
electrocardiogram (ECG) data. To achieve reliability, the real-time computing systems must be
fault-tolerant. This paper proposed a Wavelet based noise cancellation of ECG signals.
Comparison of the performance and reliability of butter worth low pass filter and wavelet
transforms are performed. Experimental results showed that the wavelet transform not only
successfully extract the ECG signals, but also is very reliable.

2
CHAPTER 1

INTRODUCTION

Electrocardiogram is the body surface manifestation of the electrical


potential produced by the heart. The ECG is acquired by placing electrodes on the patient’s skin.
In a resting setting, the principal technical issue in interpreting ECG waveforms arises from the
existence of ambient or background noise emanating from other electromagnetic sources
including signals generated by the organs, muscles and systems of the body, whether from
movement or the performance by those organs of their bodily functions, and signals generated by
the sources external to the body, such as electronic equipment, lights or engines. In order to
minimize ambient noise in the clinical setting, ECGs are normally taken in the hospital or
physician offices. Cardiologists instruct the patient to lie in the supine position, being as still as
possible while reading is taken to reduce the ambient noise caused by physical movement.
Another method to reduce the ambient noise is to reduce the sensitivity of monitoring equipment,
but this alternative result in loss of signal quality and the ability to read certain signal intricacies.

1.1 BACKGROUND

The electrical potential produced by the heart is very small and it requires care to prevent
degradation of signal content by noises. Among all the strongest source of interference is 50/60
Hz pickup from power supplies. This 50/60 Hz power line interference degrades the signal
content that may be critical for clinical monitoring and diagnosis.

The conventional means for dealing with a strong spectrally concentrated power line
interference is a fixed low pass filter which scarifies the waveform details associated with
spectral components above 50 Hz. As ECG signal lies in the frequency range of 0 to 150 Hz the
signal information above 50 Hz will be lost. Use of notch filter suppressing the energy in the
appropriate narrow spectral band represents an improvement; however it still degrades the signal
quality of interest. Therefore, wavelet transforming to remove artifact noise without distorting
the actual signal is crucial to enable the computer based clinical ECG.

3
Wavelet transforming using neural networks has been shown to be useful in many
biomedical applications. The basic idea behind the wavelet transforming has been summarized
by widows. It reduces the mean squared error between a primary input, which is the noisy ECG,
and filter output. Wavelet transforms permit to detect time varying potentials and track the
dynamic variations of the signal. These types of filters learn the deterministic signal and modify
their behavior according to the input signal. Therefore they can detect shape variations in the
ensemble and thus can obtain a better signal estimation.

1.2 MOTIVATION

Now a day’s reliability has become a topic of major concern to both system designers and
users. There is an increasing number of applications where system failures once per day or even
once per week are not acceptable. There are basically two fundamentally different approaches
that can be taken to increase the reliability of computing system. The first approach is called
fault prevention and the second fault tolerance. In the traditional fault prevention approach the
objective is to increase the reliability by prior elimination of all faults. Since this is almost
impossible to achieve in practice, the goal of fault prevention is to reduce the probability of
system failure to an acceptably low value. In the fault tolerant approach, faults are expected to
occur during computation, but their effects are automatically counteracted by incorporating
redundancy, i.e., additional facilities, into a system, so that valid computation can continue even
in the presence of faults. These facilities consists of more hardware, more software or more time,
or combination of all these; they are redundant in the sense that they could be omitted from a
fault free system without affecting its operation.

Most of the early work in fault tolerant system design was motivated by space
applications, and in particularly by the requirement for computers to be able to operate
unattended for long periods of time. While this application is still an important one, fault
tolerance is now regarded as a desirable and in some cases an essential feature of a wide range of
computing systems especially in applications where reliability, availability and safety are of vital
importance. This motivated us to develop a fault tolerant wavelet transforming for noisy ECG
signals. In that first we are considering double modular configuration and next triple modular
configuration.

4
1.3 OBJECTIVE

The aim of this work is to construct an wavelet transform and demonstrate its application
in noise cancellation.

1.4 ORGANIZATION OF THESIS

In the chapter 2 we have introduced about ECG signal. We described various features of P
wave, QRS complex and a T wave. We also described various diseases if these waves cross
normal amplitudes and durations.

In the chapter 3 we explained about what is wavelet transform and various approaches to
the development of wavelet transforms. Next how to choose an wavelet transforms depending on
the applications of wavelet transforms. Finally we described various applications of wavelet
transforms.

5
CHAPTER 2

ELECTROCARDIOGRAM

In this chapter we will see what is ECG signal and the basic function of the heart. Next
we have discussed about P wave, QRS complex and T wave and also various segments like QT
segment, PR interval and ST segment.

ECG means electrocardiogram. It is the electrical representation of heart activity over


time. The etymology of the word is derived from electro, because it is related to electrical
activity, cardio, Greek for heart; graph a Greek root meaning “to write”. ECG is acquired by
placing electrodes on the patient’s skin. An instrument used to obtain and record the
electrocardiogram is called an electrocardiograph. The electrocardiograph was the first electrical
device to find wide spread use in medical diagnosis and it still remains the most important tool
for the diagnosis of cardiac disorders.

A typical ECG cycle is defined by the various features (P, Q, R, S, and T) of the
electrical wave as shown in the Fig. 2.1. The P wave marks the activation of atria, which are the
chambers of heart that receive blood from the body. The activation of left atrium, which collects
oxygen rich blood from the lungs, and the right atrium which gathers oxygen deficient blood
from the body. Next in the ECG cycle comes the QRS complex. The QRS complex represents
the activation of ventricles. Left ventricle, which sends oxygen rich blood to the body, and the
right ventricle, which sends oxygen deficient blood the lungs. During the QRS complex atria
prepares for the next beat, and the ventricles relax in the long T wave.

To fully understand how an ECG reveals useful information about the condition of heart
requires a basic understanding of the anatomy and physiology of the heart.

6
2.1 BASIC ANATOMY OF THE HEART

The heart is a four chambered muscle whose function is to pump blood throughout the
body. The heart is really two “half hearts”, the right heart and the left heart, which beat
simultaneously. Each of these two sides has two chambers, a smaller upper chamber called the
atrium and a larger lower chamber called the ventricle. Thus, the four chamber of the heart are
called right atrium, right ventricle, left atrium, and left ventricle. This sequence also represents
the direction of the blood flow through the heart. The two upper chambers, the left and the right
atria are synchronized to act together similarly two lower chambers, the ventricles operate
together.

The right atrium receives blood that has completed a tour around the body and is depleted
of oxygen and other nutrients. This blood returns via two larger veins, the superior vena cava
returning blood from the head, neck and upper portions of the chest, and the inferior vena cava
returns blood from the remainder of the body.

The right atrium pumps this blood into the right ventricle, which a fraction of a second
later, pumps the blood into the blood vessels of the lungs. The lungs serve two functions: to
oxygenate the blood by exposing it to the air we breathe in (which is 20% oxygen), and to
eliminate the carbon dioxide that has accumulated in the blood as a result of the body‘s many
metabolic functions.

Having passed through the lungs, the blood enters the left atrium, which pumps it into the
left ventricle. The left ventricle then pumps the blood back into the circulatory system of blood
vessels (arteries and veins). The blood leaves the left ventricle via the aorta, the largest artery in
the body. Because the left ventricle has to exert enough pressure to keep the blood moving
throughout all the blood vessels of the body, it is a powerful pump. It is the pressure generated
by the left ventricle that gets measured when we have our blood pressure checked.

The heart, like all tissues in the body, requires oxygen to function. Indeed, it is the only
muscle in the body that never rests. Thus, the heart has reserved for itself its own blood supply.

7
This blood flows to the heart muscle through a group of arteries that begins less than one-half
inch from where the aorta begins. These are known as the coronary arteries.

These arteries deliver oxygen to both the heart muscle and the nerves of the heart. When
something happens so that the flow of blood through a coronary artery gets interrupted, then the
part of the heart muscle supplied by that artery begins to die. This is called coronary heart
disease or coronary artery disease. If this condition is not stopped, the heart itself starts to lose its
strength to pump blood, a condition known as heart failure. When the interruption of coronary
blood flow lasts only a few minutes, the symptoms are called angina, and there is no permanent
damage to the heart. When the interruption lasts longer, that part of the heart muscle dies. This is
referred to as a heart attack (myocardial infarction).

Nerves of the heart: The heart's function is so important to the body that it has its own
electrical system to keep it running independently of the rest of the body's nervous system. Even
in cases of severe brain damage, the heart often beats normally. An extensive network of nerves
runs throughout all 4 chambers of the heart. Electrical impulses course through these nerves to
trigger the chambers to contract with perfectly synchronized timing much like the distributor and
spark plugs of a car make sure that an engine's pistons fire in the right sequence. The ECG
records this electrical activity and depicts it as a series of graph-like tracings, or waves. The
shapes and frequencies of these tracings reveal abnormalities in the heart's anatomy or function.

Before describing the ECG itself, let's take a look at the heart's electrical system.

2.2 HEART FUNCTION AND THE ECG

The heart normally beats between 60 and 100 times per minute, with many normal
variations. For example, athletes at rest have slower heart rates than most people. This rate is set
by a small collection of specialized heart cells called the sinoatrial (SA) or sinus node. Located
in the right atrium, the sinus node is the heart's "natural pacemaker." It has "automaticity,"
meaning it discharges all by itself without control from the brain.

Two events occur with each discharge: (1) both atria contract, and (2) an electrical impulse
travels through the atria to reach another area of the heart called the atrio ventricular (AV) node,
which lies in the wall between the 2 ventricles .The AV node serves as a relay point to further

8
propagate the electrical impulse. From the AV node, an electrical wave travels to both
ventricles, causing them to contract and pump blood. The normal delay between the contraction
of the atria and of the ventricles is 0.12 to 0.20 seconds. This delay is perfectly timed to account
for the physical passage of the blood from the atrium to the ventricle. Intervals shorter or longer
than this range indicate possible problems.

The ECG records the electrical activity that results when the heart muscle cells in the atria
and ventricles contract. Atrial contractions (both right and left) show up as the P wave.
Ventricular contractions (both right and left) show as a series of 3 waves, Q-R-S, known as the
QRS complex. The third and last common wave in an ECG is the T wave. This reflects the
electrical activity produced when the ventricles are recharging for the next contraction
(repolarizing). Interestingly, the letters P, Q, R, S, and T are not abbreviations for any actual
words but were chosen many years ago for their position in the middle of the alphabet. The
electrical activity results in P, QRS, and T waves that have a myriad of sizes and shapes. When
viewed from multiple anatomic-electric perspectives (that is, leads), these waves can show a
wide range of abnormalities of both the electrical conduction system and the muscle tissue of the
heart's 4 pumping chambers. Some normal values for amplitudes and durations of important
ECG parameters are as follows:

Amplitude: P wave 0.25 mv


R wave 1.60 mv
Q wave 25% of R wave
T wave 0.1 to 0.5 mv
Duration: P-R interval 0.12 to 0.20 sec
Q-T interval 0.35 to 0.44 sec
S-T segment 0.05 to 0.15 sec
P wave interval 0.11 sec
QRS interval 0.09 sec
To the clinician, the shape and duration of the each feature of the ECG are significant. In
general, the cardiologist looks critically at the various time intervals, polarities, and amplitudes
to arrive at his diagnosis. For his diagnosis, a cardiologist would typically look first at the heart
9
rate. The normal value lies in the range of 60 to 100 beats per minute. A slower rate than this is
called bradycardia (slow rate) and a higher rate, tachycardia (fast rate). He would then see if the
cycles are evenly spaced. If not, an arrhythmia may be indicated. If the P-R interval is greater
than 0.2 second, it can suggest blockage of the AV node. If one or more of the basic features of
the ECG are missing, a heart block of some sort might be indicated.

In healthy individuals the electrocardiogram remains reasonably constant, even though the
heart rate changes with the demands of the body. Under pathological conditions, several changes
may occur in the ECG. These include (1)altered paths of excitation in the heart,(2)changed origin
of waves(ectopic beats),(3)altered relationships (sequences) of features, (4) changed magnitude
of one or more features and (5)differing duration of wave or intervals.

2.3 WAVES AND INTERVALS

A typical ECG signal is shown in Fig.2.1. A typical ECG tracing of a normal heartbeat (or
cardiac cycle) consists of a P wave, a QRS complex and a T wave. A small U wave is normally
visible in 50 to 75% of ECGs. The baseline voltage of the electrocardiogram is known as the iso
electric line. Typically the iso electric line is measured as the portion of the tracing following the
T wave and preceding the next P wave. The four deflections were originally named ABCDE but
renamed PQRST after correction for artifacts introduced by early amplifiers.

2.3.1 P wave

10
During normal atrial depolarization, the main electrical vector is directed from the SA
node towards the AV node, and spreads from the right atrium to the left atrium. This turns into
the P wave on the ECG.

 The relationship between P waves and QRS complexes helps distinguish various cardiac
arrhythmias.
 The shape and duration of the P waves may indicate atrial enlargement.
 Absence of the P wave may indicate atrial fibrillation.
 A saw tooth formed P wave may indicate atrial flutter.

2.3.2 QRS complex

The QRS complex is a recording of a single heartbeat on the ECG that corresponds to the
depolarization of the right and left ventricles. Ventricles contain more muscle mass than the atria,
therefore the QRS complex is considerably larger than the P wave. The His/Purkinje cardiac
nerves coordinate the depolarization of both ventricles, the QRS complex is 0.08 to 0.12 sec (80
to 120 ms) in duration represented by three small squares or less, but any abnormality of
conduction takes longer, and causes widened QRS complexes.

Not every QRS complex contains a Q wave, an R wave, and an S wave. By convention,
any combination of these waves can be referred to as a QRS complex. However, correct
interpretation of difficult ECGs requires exact labeling of the various waves. Some authors use
lowercase and capital letters, depending on the relative size of each wave. For example, an Rs
complex would be positively deflected, while a RS complex would be negatively deflected. If
both complexes were labeled RS, it would be impossible to appreciate this distinction without
viewing the actual ECG.

 The duration, amplitude, and morphology of the QRS complex is useful in diagnosing
cardiac arrhythmias, conduction abnormalities, ventricular hypertrophy, myocardial
infarction, electrolyte derangements, and other disease states.
 Q waves can be normal (physiological) or pathological. Pathological Q waves refer to Q
waves that have a height of 25% or more than that of the partner R wave and/or have a
width of greater than 0.04 seconds. Normal Q waves, when present, represent

11
depolarization of the inter ventricular septum. For this reason, they are referred to as
septal Q waves.
 Q waves greater than 1/4 the height of the R wave, greater than 0.04 sec (40 ms) in
duration, or in the right precordial leads are considered to be abnormal, and may
represent myocardial infarction.
 "Buried" inside the QRS wave is the atrial repolarization wave, which resembles an
inverse P wave. It is far smaller in magnitude than the QRS and is therefore obscured by
it.

2.3.3 PR/PQ interval

The PR interval is measured from the beginning of the P wave to the beginning of the QRS
complex. It is usually 120 to 200 ms long. On an ECG tracing, this corresponds to 3 to 5 small
boxes. In case a Q wave was measured with a ECG the PR interval is also commonly named PQ
interval instead.

 A PR interval of over 200 ms may indicate a first degree heart block.


 A short PR interval may indicate a pre excitation syndrome via an accessory pathway that
leads to early activation of the ventricles, such as seen in Wolff-Parkinson-White
syndrome.
 A variable PR interval may indicate other types of heart block.
 PR segment depression may indicate atrial injury or pericarditis.
 Variable morphologies of P waves in a single ECG lead is suggestive of an ectopic
pacemaker rhythm such as wandering pacemaker or multifocal atrial tachycardia

2.3.4 ST segment

The ST segment connects the QRS complex and the T wave and has duration of 0.08 to
0.12 sec (80 to 120 ms). It starts at the J point (junction between the QRS complex and ST
segment) and ends at the beginning of the T wave. However, since it is usually difficult to
determine exactly where the ST segment ends and the T wave begins, the relationship between
the RT segment and T wave should be examined together. The typical ST segment duration is
usually around 0.08 sec (80 ms). It should be essentially level with the PR and TP segment.

12
 The normal ST segment has a slight upward concavity.
 Flat, down sloping or depressed ST segments may indicate coronary ischemia.
 ST segment elevation may indicate myocardial infarction. An elevation of >1mm and
longer than 80 milliseconds following the J-point. This measure has a false positive rate
of 15-20% (which is slightly higher in women than men) and a false negative rate of 20-
30%.

2.3.5 T wave

The T wave represents the repolarization(or recovery) of the ventricles. The interval from
the beginning of the QRS complex to the apex of the T wave is referred to as the absolute
refractory period. The last half of the T wave is referred to as the relative refractory period (or
vulnerable period).

 Inverted (or negative) T waves can be a sign of coronary ischemia, Wellens' syndrome,
left ventricular hypertrophy, or CNS disorder.
 Tall or "tented" symmetrical T waves may indicate hyperkalemia. Flat T waves may
indicate coronary ischemia or hypokalemia.
 The earliest electrocardiographic finding of acute myocardial infarction is sometimes the
hyper acute T wave, which can be distinguished from hyper kalemia by the broad base
and slight asymmetry.
 When a conduction abnormality (e.g., left bundle branch block, paced rhythm) is present,
the T wave should be deflected opposite the terminal deflection of the QRS complex.
This is known as appropriate T wave discordance.

2.3.6 QT interval

The QT interval is measured from the beginning of the QRS complex to the end of the T
wave. Normal values for the QT interval are between 0.30 and 0.44 seconds. The QT intervals as
well as the corrected QT interval are important in the diagnosis of long QT syndrome and short
QT syndrome. Long QT intervals may also be induced by anti arrythmic agents that block
potassium channel in the cardiac myocyte. The QT interval varies based on the heart rate, and
various correction factors have been developed to correct the QT interval for the heart rate. The

13
QT interval represents on an ECG the total time needed for the ventricles to depolarize and
repolarize.

The most commonly used method for correcting the QT interval for rate is the one
formulated by Bazett and published in 1920.Bazett's formula is,

QTC =
𝑄𝑇 (2.1)
√𝑅𝑅

Where QTC is the QT interval corrected for rate, and RR is the interval from the onset of one
QRS complex to the onset of the next QRS complex, measured in seconds. However, this
formula tends to be inaccurate, and over-corrects at high heart rates and under-corrects at low
heart rates.QTC may also be found via the following formula:

QTC = QT + 1.75(Ventricular Rate ─ 60) (2.2)

14
CHAPTER 3

WAVELET

First of all, why do we need a transform, or what is a transform anyway?

Mathematical transformations are applied to signals to obtain further information from that
signal that is not readily available in the raw signal. In the following tutorial I will assume a
time-domain signal as a raw signal, and a signal that has been "transformed" by any of the
available mathematical transformations as a processed signal. There are number of
transformations that can be applied, among which the Fourier transforms are probably by far the
most popular.

Most of the signals in practice, are TIME-DOMAIN signals in their raw format. That is,
whatever that signal is measuring, is a function of time. In other words, when we plot the signal
one of the axes is time (independent variable), and the other (dependent variable) is usually the
amplitude. When we plot time-domain signals, we obtain a time-amplitude representation of the
signal. This representation is not always the best representation of the signal for most signal
processing related applications. In many cases, the most distinguished information is hidden in
the frequency content of the signal. The frequency SPECTRUM of a signal is basically the
frequency components (spectral components) of that signal. The frequency spectrum of a signal
shows what frequencies exist in the signal.

Intuitively, we all know that the frequency is something to do with the change in rate of
something. If something (a mathematical or physical variable, would be the technically correct
term) changes rapidly, we say that it is of high frequency, where as if this variable does not
change rapidly, i.e., it changes smoothly, we say that it is of low frequency. If this variable does
not change at all, then we say it has zero frequency, or no frequency.

15
Why do we need the frequency information?

Often times, the information that cannot be readily seen in the time-domain can be
seen in the frequency domain.

Let's give an example from biological signals. Suppose we are looking at an ECG
signal (Electrocardiography, graphical recording of heart's electrical activity). The typical shape
of a healthy ECG signal is well known to cardiologists. Any significant deviation from that shape
is usually considered to be a symptom of a pathological condition.

This pathological condition, however, may not always be quite obvious in the
original time-domain signal. Cardiologists usually use the time-domain ECG signals which are
recorded on strip-charts to analyze ECG signals. Recently, the new computerized ECG
recorders/analyzers also utilize the frequency information to decide whether a pathological
condition exists. A pathological condition can sometimes be diagnosed more easily when the
frequency content of the signal is analyzed.

This, of course, is only one simple example why frequency content might be
useful. Today Fourier transforms are used in many different areas including all branches of
engineering.

Although FT is probably the most popular transform being used (especially in


electrical engineering), it is not the only one. There are many other transforms that are used quite
often by engineers and mathematicians. Hilbert transform, short-time Fourier transform (more
about this later), Wigner distributions, the Radon Transform, and of course our featured
transformation , the wavelet transform, constitute only a small portion of a huge list of
transforms that are available at engineer's and mathematician's disposal. Every transformation
technique has its own area of application, with advantages and disadvantages, and the wavelet
transform (WT) is no exception.

For a better understanding of the need for the WT let's look at the FT more
closely. FT (as well as WT) is a reversible transform, that is, it allows to go back and forward
between the raw and processed (transformed) signals. However, only either of them is available

16
at any given time. That is, no frequency information is available in the time-domain signal, and
no time information is available in the Fourier transformed signal. The natural question that
comes to mind is that is it necessary to have both the time and the frequency information at the
same time?

As we will see soon, the answer depends on the particular application and the
nature of the signal in hand. Recall that the FT gives the frequency information of the signal,
which means that it tells us how much of each frequency exists in the signal, but it does not tell
us when in time these frequency components exist. This information is not required when the
signal is so-called stationary.

Let's take a closer look at this stationary concept more closely, since it is of
paramount importance in signal analysis. Signals whose frequency content do not change in time
are called stationary signals. In other words, the frequency content of stationary signals do not
change in time. In this case, one does not need to know at what times frequency components
exist, since all frequency components exist at all times!!! .

For example the following signal

𝑥(𝑡) = 𝑐𝑜𝑠(2 ∗ 𝑝𝑖 ∗ 10 ∗ 𝑡) + 𝑐𝑜𝑠(2 ∗ 𝑝𝑖 ∗ 25 ∗ 𝑡) + 𝑐𝑜𝑠(2 ∗ 𝑝𝑖 ∗ 50 ∗ 𝑡) + 𝑐𝑜𝑠(2 ∗ 𝑝𝑖 ∗ 100 ∗ 𝑡)

Is a stationary signal, because it has frequencies of 10, 25, 50, and 100 Hz at any given time
instant? This signal is plotted below:

17
Figure 1

And the following is its FT:

Figure 2

The top plot in Figure 2 is the (half of the symmetric) frequency spectrum of the
signal in Figure 1. The bottom plot is the zoomed version of the top plot, showing only the range

18
of frequencies that are of interest to us. Note the four spectral components corresponding to the
frequencies 10, 25, 50 and 100 Hz.

Contrary to the signal in Figure 1, the following signal is not stationary. Figure
3 plots a signal whose frequency constantly changes in time. This signal is known as the "chirp"
signal. This is a non-stationary signal.

Figure 3

Let's look at another example. Figure 4 plots a signal with four different
frequency components at four different time intervals, hence a non-stationary signal. The interval
0 to 300 ms has a 100 Hz sinusoid, the interval 300 to 600 ms has a 50 Hz sinusoid, the interval
600 to 800 ms has a 25 Hz sinusoid, and finally the interval 800 to 1000 ms has a 10 Hz
sinusoid.

19
Figure 4

And the following is its FT:

Figure 5

20
Now, compare the Figures 1 and 5. The similarity between these two spectrum
should be apparent. Both of them show four spectral components at exactly the same
frequencies, i.e., at 10, 25, 50, and 100 Hz. Other than the ripples, and the difference in
amplitude (which can always be normalized), the two spectrums are almost identical, although
the corresponding time-domain signals are not even close to each other. Both of the signals
involve the same frequency components, but the first one has these frequencies at all times, the
second one has these frequencies at different intervals. So, how come the spectrums of two
entirely different signals look very much alike? Recall that the FT gives the spectral content of
the signal, but it gives no information regarding where in time those spectral components appear.
Therefore, FT is not a suitable technique for non-stationary signal, with one exception:

FT can be used for non-stationary signals, if we are only interested in what


spectral components exist in the signal, but not interested where these occur. However, if this
information is needed, i.e., if we want to know, what spectral component occur at what time
(interval) , then Fourier transform is not the right transform to use.

For practical purposes it is difficult to make the separation, since there are a lot
of practical stationary signals, as well as non-stationary ones. Almost all biological signals, for
example, are non-stationary. Some of the most famous ones are ECG (electrical activity of the
heart, electrocardiograph), EEG (electrical activity of the brain, electroencephalograph), and
EMG (electrical activity of the muscles, electromyogram).

Once again please note that, the FT gives what frequency components (spectral
components) exist in the signal. Nothing more, nothing less.

When the time localization of the spectral components are needed, a transform
giving the TIME-FREQUENCY REPRESENTATION of the signal is needed.

21
THE WAVELET TRANSFORM

The Wavelet transform is a transform of this type. It provides the time-frequency


representation. (There are other transforms which give this information too, such as short time
Fourier transforms, Wigner distributions, etc.)

Often times a particular spectral component occurring at any instant can be of


particular interest. In these cases it may be very beneficial to know the time intervals these
particular spectral components occur. For example, in EEGs, the latency of an event-related
potential is of particular interest (Event-related potential is the response of the brain to a specific
stimulus like flash-light, the latency of this response is the amount of time elapsed between the
onset of the stimulus and the response).

Wavelet transform is capable of providing the time and frequency information


simultaneously, hence giving a time-frequency representation of the signal.

How wavelet transform works is completely a different fun story, and should be
explained after short time Fourier Transform (STFT) . The WT was developed as an alternative
to the STFT. The STFT will be explained in great detail in the second part of this tutorial. It
suffices at this time to say that he WT was developed to overcome some resolution related
problems of the STFT, as explained in Part II.

To make a real long story short, we pass the time-domain signal from various
high pass and low pass filters, which filter out either high frequency or low frequency portions of
the signal. This procedure is repeated, every time some portion of the signal corresponding to
some frequencies being removed from the signal.

Here is how this works: Suppose we have a signal which has frequencies up to
1000 Hz. In the first stage we split up the signal in to two parts by passing the signal from a high
pass and a low pass filter (filters should satisfy some certain conditions, so-called admissibility
condition) which results in two different versions of the same signal: portion of the signal
corresponding to 0-500 Hz (low pass portion), and 500-1000 Hz (high pass portion).

22
Then, we take either portion (usually low pass portion) or both, and do the same
thing again. This operation is called decomposition.

Assuming that we have taken the low pass portion, we now have 3 sets of data, each
corresponding to the same signal at frequencies 0-250 Hz, 250-500 Hz, 500-1000 Hz.

Then we take the low pass portion again and pass it through low and high pass
filters; we now have 4 sets of signals corresponding to 0-125 Hz, 125-250 Hz,250-500 Hz, and
500-1000 Hz. We continue like this until we have decomposed the signal to a pre-defined certain
level. Then we have a bunch of signals, which actually represent the same signal, but all
corresponding to different frequency bands. We know which signal corresponds to which
frequency band, and if we put all of them together and plot them on a 3-D graph, we will have
time in one axis, frequency in the second and amplitude in the third axis. This will show us
which frequencies exist at which time ( there is an issue, called "uncertainty principle", which
states that, we cannot exactly know what frequency exists at what time instance , but we can only
know what frequency bands exist at what time intervals.

The uncertainty principle, originally found and formulated by Heisenberg, states


that, the momentum and the position of a moving particle cannot be known simultaneously. This
applies to our subject as follows:

The frequency and time information of a signal at some certain point in the time-
frequency plane cannot be known. In other words: We cannot know what spectral component
exists at any given time instant. The best we can do is to investigate what spectral components
exist at any given interval of time. This is a problem of resolution, and it is the main reason why
researchers have switched to WT from STFT. STFT gives a fixed resolution at all times, whereas
WT gives a variable resolution as follows:

Higher frequencies are better resolved in time, and lower frequencies are better
resolved in frequency. This means that, a certain high frequency component can be located better
in time (with less relative error) than a low frequency component. On the contrary, a low
frequency component can be located better in frequency compared to high frequency component.
Below , are some examples of continuous wavelet transform:

23
Let's take a sinusoidal signal, which has two different frequency components at two
different times:

Note the low frequency portion first, and then the high frequency.

Figure 6

24
The continuous wavelet transform of the above signal:

figure 7

Note however, the frequency axis in these plots is labeled as scale. The concept
of the scale will be made clearer in the subsequent sections, but it should be noted at this time that
the scale is inverse of frequency. That is, high scales correspond to low frequencies, and low
scales correspond to high frequencies. Consequently, the little peak in the plot corresponds to the
high frequency components in the signal, and the large peak corresponds to low frequency
components (which appear before the high frequency components in time) in the signal.

You might be puzzled from the frequency resolution shown in the plot, since it
shows good frequency resolution at high frequencies. Note however that, it is the good scale
resolution that looks good at high frequencies (low scales), and good scale resolution means poor
frequency resolution and vice versa.

25
THE FOURIER TRANSFORM

In 19th century (1822*, to be exact, but you do not need to know the exact time.
Just trust me that it is far before than you can remember), the French mathematician J. Fourier,
showed that any periodic function can be expressed as an infinite sum of periodic complex
exponential functions. Many years after he had discovered this remarkable property of (periodic)
functions, his ideas were generalized to first non-periodic functions, and then periodic or non-
periodic discrete time signals. It is after this generalization that it became a very suitable tool for
computer calculations. In 1965, a new algorithm called fast Fourier Transform (FFT) was
developed and FT became even more popular.

Now let us take a look at how Fourier transform works:


FT decomposes a signal to complex exponential functions of different frequencies. The way it
does this, is defined by the following two equations:


𝑋(𝑓) = ∫−∞ 𝑥(𝑡) × 𝑒 −2𝑗𝜋𝑓𝑡 𝑑𝑡 (1)


𝑥(𝑡) = ∫−∞ 𝑋(𝑓) × 𝑒 2𝑗𝜋𝑓𝑡 𝑑𝑓 (2)

In the above equation, t stands for time, f stands for frequency, and x denotes
the signal at hand. Note that x denotes the signal in time domain and the X denotes the signal in
frequency domain. This convention is used to distinguish the two representations of the signal.
FT Equation (1) is called the Fourier transform of x(t), and FT equation (2) is called the inverse
Fourier transform of X(f), which is x(t).

For those of you who have been using the Fourier transform are already
familiar with this. Unfortunately many people use these equations without knowing the
underlying principle.

26
The signal x(t), is multiplied with an exponential term, at some certain
frequency "f" , and then integrated over ALL TIMES !!! Note that the exponential term in FT
Eqn. (1) can also be written as:

Cos(2.pi.f.t)+ j.Sin(2.pi.f.t).......(3)

The above expression has a real part of cosine of frequency f, and an imaginary
part of sine of frequency f. So what we are actually doing is, multiplying the original signal with
a complex expression which has sine and cosine of frequency f. Then we integrate this product.
In other words, we add all the points in this product. If the result of this integration (which is
nothing but some sort of infinite summation) is a large value, then we say that : the signal x(t),
has a dominant spectral component at frequency "f". This means that, a major portion of this
signal is composed of frequency f. If the integration result is a small value, than this means that
the signal does not have a major frequency component of f in it. If this integration result is zero,
then the signal does not contain the frequency "f" at all.

It is of particular interest here to see how this integration works: The signal is
multiplied with the sinusoidal term of frequency "f". If the signal has a high amplitude
component of frequency "f", then that component and the sinusoidal term will coincide, and the
product of them will give a (relatively) large value. This shows that, the signal "x", has a major
frequency component of "f".

However, if the signal does not have a frequency component of "f", the
product will yield zero, which shows that, the signal does not have a frequency component of
"f". If the frequency "f", is not a major component of the signal "x(t)", then the product will give
a (relatively) small value. This shows that, the frequency component "f" in the signal "x", has a
small amplitude, in other words, it is not a major component of "x".

Now, note that the integration in the transformation equation (FT Eqn. 1) is
over time. The left hand side of (1), however, is a function of frequency. Therefore, the integral
in (1), is calculated for every value of f.

27
The information provided by the integral, corresponds to all time instances,
since the integration is from minus infinity to plus infinity over time. It follows that no matter
where in time the component with frequency "f" appears, it will affect the result of the
integration equally as well. In other words, whether the frequency component "f" appears at time
t1 or t2 , it will have the same effect on the integration. This is why Fourier transform is not
suitable if the signal has time varying frequency, i.e., the signal is non-stationary. If only the
signal has the frequency component "f" at all times (for all "t" values), then the result obtained
by the Fourier transform makes sense.

Note that the Fourier transform tells whether a certain frequency component exists
or not. This information is independent of where in time this component appears. It is therefore
very important to know whether a signal is stationary or not, prior to processing it with the FT.

THE SHORT TIME FOURIER TRANSFORM

There is only a minor difference between STFT and FT. In STFT, the signal is divided
into small enough segments, where these segments (portions) of the signal can be assumed to be
stationary. For this purpose, a window function "w" is chosen. The width of this window must be
equal to the segment of the signal where its stationarity is valid.

This window function is first located to the very beginning of the signal. That is, the
window function is located at t=0. Let's suppose that the width of the window is "T" s. At this
time instant (t=0), the window function will overlap with the first T/2 seconds (I will assume that
all time units are in seconds). The window function and the signal are then multiplied. By doing
this, only the first T/2 seconds of the signal is being chosen, with the appropriate weighting of
the window (if the window is a rectangle, with amplitude "1", then the product will be equal to
the signal). Then this product is assumed to be just another signal, whose FT is to be taken. In
other words, FT of this product is taken, just as taking the FT of any signal.

The result of this transformation is the FT of the first T/2 seconds of the signal. If this
portion of the signal is stationary, as it is assumed, then there will be no problem and the
obtained result will be a true frequency representation of the first T/2 seconds of the signal.

28
The next step, would be shifting this window (for some t1 seconds) to a new
location, multiplying with the signal, and taking the FT of the product. This procedure is
followed, until the end of the signal is reached by shifting the window with "t1" seconds
intervals.

The following definition of the STFT summarizes all the above explanations in one line:

(𝜔)
𝑆𝑇𝐹𝑇𝑋 (𝑡, 𝑓) = ∫[𝑥(𝑡) ∗ 𝜔∗ (𝑡 − 𝑡 ′ )] ∗ 𝑒 −𝑗2𝜋𝑓𝑡 𝑑𝑡 (3)

Please look at the above equation carefully. x(t) is the signal itself, w(t) is the
window function, and * is the complex conjugate. As you can see from the equation, the STFT of
the signal is nothing but the FT of the signal multiplied by a window function.

For every t' and f a new STFT coefficient is computed (Correction: The "t" in the
parenthesis of STFT should be "t'". I will correct this soon. I have just noticed that I have
mistyped it).

The following figure (fig. 8) may help you to understand this a little better:

Fig.8

29
The Gaussian-like functions in color are the windowing functions. The red one
shows the window located at t=t1', the blue shows t=t2', and the green one shows the window
located at t=t3'. These will correspond to three different FTs at three different times. Therefore,
we will obtain a true time-frequency representation (TFR) of the signal.

Probably the best way of understanding this would be looking at an example. First
of all, since our transform is a function of both time and frequency (unlike FT, which is a
function of frequency only), the transform would be two dimensional (three, if you count the
amplitude too). Let's take a non-stationary signal, such as the following one in figure 9:

Figure 9

In this signal, there are four frequency components at different times. The interval
0 to 250 ms is a simple sinusoid of 300 Hz, and the other 250 ms intervals are sinusoids of 200
Hz, 100 Hz, and 50 Hz, respectively. Apparently, this is a non-stationary signal. Now, let's look
at its STFT:

30
Figure 10

As expected, this is two dimensional plots (3 dimensional, if you count the


amplitude too). The "x" and "y" axes are time and frequency, respectively. Please, ignore the
numbers on the axes, since they are normalized in some respect, which is not of any interest to us
at this time. Just examine the shape of the time-frequency representation.

First of all, note that the graph is symmetric with respect to midline of the
frequency axis. Remember that, although it was not shown, FT of a real signal is always
symmetric, since STFT is nothing but a windowed version of the FT, it should come as no
surprise that STFT is also symmetric in frequency. The symmetric part is said to be associated
with negative frequencies, an odd concept which is difficult to comprehend, fortunately, it is not
important; it suffices to know that STFT and FT are symmetric.

What is important, are the four peaks; note that there are four peaks
corresponding to four different frequency components. Also note that, unlike FT, these four

31
peaks are located at different time intervals along the time axis . Remember that the original
signal had four spectral components located at different times.

You may wonder, since STFT gives the TFR of the signal, why do we need the
wavelet transform. The implicit problem of the STFT is not obvious in the above example. Of
course, an example that would work nicely was chosen on purpose to demonstrate the concept.

The problem with STFT is the fact whose roots go back to what is known as the
Heisenberg Uncertainty Principle. This principle originally applied to the momentum and
location of moving particles, can be applied to time-frequency information of a signal. Simply,
this principle states that one cannot know the exact time-frequency representation of a signal,
i.e., one cannot know what spectral components exist at what instances of times. What one can
know is the time intervals in which certain band of frequencies exist, which is a resolution
problem.

The problem with the STFT has something to do with the width of the window
function that is used. To be technically correct, this width of the window function is known as
the support of the window. If the window function is narrow, than it is known as compactly
supported. This terminology is more often used in the wavelet world, as we will see later.

Recall that in the FT there is no resolution problem in the frequency domain, i.e.,
we know exactly what frequencies exist; similarly we there is no time resolution problem in the
time domain, since we know the value of the signal at every instant of time. Conversely, the time
resolution in the FT, and the frequency resolution in the time domain are zero, since we have no
information about them. What gives the perfect frequency resolution in the FT is the fact that the
window used in the FT is its kernel, the exp{jwt} function, which lasts at all times from minus
infinity to plus infinity. Now, in STFT, our window is of finite length, thus it covers only a
portion of the signal, which causes the frequency resolution to get poorer. What I mean by
getting poorer is that, we no longer know the exact frequency components that exist in the signal,
but we only know a band of frequencies that exist:

In FT, the kernel function, allows us to obtain perfect frequency resolution,


because the kernel itself is a window of infinite length. In STFT is window is of finite length,

32
and we no longer have perfect frequency resolution. You may ask, why don't we make the length
of the window in the STFT infinite, just like as it is in the FT, to get perfect frequency
resolution? Well, than you loose all the time information, you basically end up with the FT
instead of STFT. To make a long story real short, we are faced with the following dilemma:

If we use a window of infinite length, we get the FT, which gives perfect
frequency resolution, but no time information. Furthermore, in order to obtain the stationarity,
we have to have a short enough window, in which the signal is stationary. The narrower we
make the window, the better the time resolution, and better the assumption of stationarity, but
poorer the frequency resolution:

Narrow window ===>good time resolution, poor frequency resolution.


Wide window ===>good frequency resolution, poor time resolution.

33
THE CONTINUOUS WAVELET TRANSFORM

The continuous wavelet transform was developed as an alternative approach to


the short time Fourier transforms to overcome the resolution problem. The wavelet analysis is
done in a similar way to the STFT analysis, in the sense that the signal is multiplied with a
function, {\it the wavelet}, similar to the window function in the STFT, and the transform is
computed separately for different segments of the time-domain signal. However, there are two
main differences between the STFT and the CWT:

1. The Fourier transforms of the windowed signals are not taken, and therefore
single peak will be seen corresponding to a sinusoid, i.e., negative frequencies are not computed.

2. The width of the window is changed as the transform is computed for every
single spectral component, which is probably the most significant characteristic of the wavelet
transform.

The continuous wavelet transform is defined as follows

Equation 5.1.1

As seen in the above equation 5.1.1, the transformed signal is a function of two variables, tau and
s , the translation and scale parameters, respectively. psi(t) is the transforming function, and it is
called the mother wavelet . The term mother wavelet gets its name due to two important
properties of the wavelet analysis.

The term wavelet means a small wave. The smallness refers to the condition that
this (window) function is of finite length (compactly supported). The wave refers to the
condition that this function is oscillatory. The term mother implies that the functions with
different region of support that are used in the transformation process are derived from one main

34
function, or the mother wavelet. In other words, the mother wavelet is a prototype for generating
the other window functions.

The term translation is used in the same sense as it was used in the STFT; it is
related to the location of the window, as the window is shifted through the signal. This term,
obviously, corresponds to time information in the transform domain. However, we do not have a
frequency parameter, as we had before for the STFT. Instead, we have scale parameter which is
defined as $1/frequency$. The term frequency is reserved for the STFT.

The Scale:

The parameter scale in the wavelet analysis is similar to the scale used in maps.
As in the case of maps, high scales correspond to a non-detailed global view (of the signal), and
low scales correspond to a detailed view. Similarly, in terms of frequency, low frequencies (high
scales) correspond to a global information of a signal (that usually spans the entire signal),
whereas high frequencies (low scales) correspond to a detailed information of a hidden pattern in
the signal (that usually lasts a relatively short time). Cosine signals corresponding to various
scales are given as examples in the following figure .

35
Figure 12

Fortunately in practical applications, low scales (high frequencies) do not last


for the entire duration of the signal, unlike those shown in the figure, but they usually appear
from time to time as short bursts, or spikes. High scales (low frequencies) usually last for the
entire duration of the signal.

Scaling, as a mathematical operation, either dilates or compresses a signal.


Larger scales correspond to dilated (or stretched out) signals and small scales correspond to
compressed signals. All of the signals given in the figure are derived from the same cosine

36
signal, i.e., they are dilated or compressed versions of the same function. In the above figure,
s=0.05 is the smallest scale, and s=1 is the largest scale.

In terms of mathematical functions, if f(t) is a given function f(st) corresponds


to a contracted (compressed) version of f(t) if s > 1 and to an expanded (dilated) version of f(t) if
s<1.

However, in the definition of the wavelet transform, the scaling term is used
in the denominator, and therefore, the opposite of the above statements holds, i.e., scales s > 1
dilates the signals whereas scales s < 1 , compresses the signal.

The Discrete Wavelet Transform:

The Wavelet Series is just a sampled version of CWT and its computation may
consume significant amount of time and resources, depending on the resolution required. The
Discrete Wavelet Transform (DWT), which is based on sub-band coding, is found to yield a fast
computation of Wavelet Transform. It is easy to implement and reduces the computation time
and resources required.

The foundations of DWT go back to 1976 when techniques to decompose


discrete time signals were devised. Similar work was done in speech signal coding which was
named as sub-band coding. In 1983, a technique similar to sub-band coding was developed
which was named pyramidal coding. Later many improvements were made to these coding
schemes which resulted in efficient multi-resolution analysis schemes.

In CWT, the signals are analyzed using a set of basis functions which relate to
each other by simple scaling and translation. In the case of DWT, a time-scale representation of
the digital signal is obtained using digital filtering techniques. The signal to be analyzed is
passed through filters with different cutoff frequencies at different scales.

37
MULTIRESOLUTION ANALYSIS

Although the time and frequency resolution problems are results of a physical
phenomenon (the Heisenberg uncertainty principle) and exist regardless of the transform used, it
is possible to analyze any signal by using an alternative approach called the multi resolution
analysis (MRA) .

MRA, as implied by its name, analyzes the signal at different frequencies with different
resolutions. Every spectral component is not resolved equally as was the case in the STFT.MRA
is designed to give good time resolution and poor frequency resolution at high frequencies and
good frequency resolution and poor time resolution at low frequencies. This approach makes
sense especially when the signal at hand has high frequency components for short durations and
low frequency components for long durations. Fortunately, the signals that are encountered in
practical applications are often of this type. For example, the following figure 11 shows a signal
of this type. It has a relatively low frequency component throughout the entire signal and
relatively high frequency components for a short duration somewhere around the middle.

Figure 11

38
Multi-Resolution Analysis using Filter Banks:

Filters are one of the most widely used signal processing functions.
Wavelets can be realized by iteration of filters with rescaling. The resolution of the signal, which
is a measure of the amount of detail information in the signal, is determined by the filtering
operations, and the scale is determined by up sampling and down sampling (sub sampling)
operations.

The DWT is computed by successive low pass and high pass filtering of the
discrete time-domain signal as shown in figure 13. This is called the Mallat algorithm or Mallat-
tree decomposition. Its significance is in the manner it connects the continuous-time multi
resolution to discrete-time filters. In the figure13, the signal is denoted by the sequence x[n],
where n is an integer. The low pass filter is denoted by G0 while the high pass filter is denoted by
H0. At each level, the high pass filter produces detail information; d[n], while the low pass filter
associated with scaling function produces coarse approximations, a[n].

Figure 13 Three-level wavelet decomposition tree

At each decomposition level, the half band filters produce signals spanning only
half the frequency band. This doubles the frequency resolution as the UN certainty in frequency
is reduced by half. In accordance with Nyquist’s rule if the original signal has highest frequency
of ω, which requires a sampling frequency of 2ω radians, then it now has a highest frequency of
ω/2 radians. It can now be sampled at a frequency of ω radians thus discarding half the samples
with no loss of information. This decimation by 2 halves the time resolution as the entire signal
39
is now represented by only half the number of samples. Thus, while the half band low pass
filtering removes half of the frequencies and thus halves the resolution, the decimation by 2
doubles the scale. With this approach, the time resolution becomes arbitrarily good at high
frequencies, while the frequency resolution becomes arbitrarily good at low frequencies. The
filtering and decimation process is continued until the desired level is reached. The maximum
number of levels depends on the length of the signal.

The DWT of the original signal is then obtained by concatenating all the
coefficients, a[n] and d[n], starting from the last level of decomposition.

Figure 14 Three-level wavelet reconstruction tree.

Figure 15 shows the reconstruction of the original signal from the wavelet
coefficients. Basically, the reconstruction is the reverse process of decomposition. The
approximation and detail coefficients at every level are up sampled by two, passed through the
low pass and high pass synthesis filters and then added. This process is continued through the
same number of levels as in the decomposition process to obtain and H the original signal.

40
One-Stage Filtering: Approximations and Details:

For many signals, the low-frequency content is the most important part. It is what
gives the signal its identity. The high-frequency content on the other hand imparts flavor or
nuance. Consider the human voice. If you remove the high-frequency components, the voice
sounds different but you can still tell what’s being said. However, if you remove enough of the
low-frequency components, you hear gibberish. In wavelet analysis, we often speak of
approximations and details. The approximations are the high-scale, low-frequency components
of the signal. The details are the low-scale, high-frequency components.

The filtering process at its most basic level looks like this:

Figure16: Filtering Process

The original signal S passes through two complementary filters and emerges as two signals.

Unfortunately, if we actually perform this operation on a real digital signal, we


wind up with twice as much data as we started with. Suppose, for instance that the original signal
S consists of 1000 samples of data. Then the resulting signals will each have 1000 samples, for a
total of 2000.

41
These signals A and D are interesting, but we get 2000 values instead of the
1000 we had. There exists a more subtle way to perform the decomposition using wavelets. By
looking carefully at the computation, we may keep only one point out of two in each of the two
2000-length samples to get the complete information. This is the notion of own sampling. We
produce two sequences called cA and cD.

Figure 17: Sampling

The process on the right which includes down sampling produces DWT
Coefficients. To gain a better appreciation of this process let’s perform a one-stage discrete
wavelet transform of a signal. Our signal will be a pure sinusoid with high- frequency noise
added to it.

42
Here is our schematic diagram with real signals inserted into it:

Figure 18: Schematic Diagram

Multiple-Level Decomposition:

The decomposition process can be iterated, with successive approximations being


decomposed in turn, so that one signal is broken down into many lower resolution components.
This is called the wavelet decomposition tree.

figure19: Wavelet Decomposition Tree

43
Looking at a signal’s wavelet decomposition tree can yield valuable information.

Figure 20: Wavelet Decomposition Tree

Number of Levels:

Since the analysis process is iterative, in theory it can be continued indefinitely. In


reality, the decomposition can proceed only until the individual details consist of a single sample
or pixel. In practice, you’ll select a suitable number of levels based on the nature of the signal, or
on a suitable criterion such as entropy.

Wavelet Reconstruction:

The discrete wavelet transform can be used to analyze, or decompose, signals and
images. This process is called decomposition or analysis. The other half of the story is how those
components can be assembled back into the original signal without loss of information. This
process is called reconstruction, or synthesis. The mathematical manipulation that effects
synthesis is called the inverse discrete wavelet transform (IDWT). To synthesize a signal using
Wavelet Toolbox™ software, we reconstruct it from the wavelet coefficients:

44
Where wavelet analysis involves filtering and down sampling, the wavelet reconstruction process
consists of up sampling and filtering. Up sampling is the process of lengthening a signal
component by inserting zeros between samples:

The toolbox includes commands, like idwt and waverec, that perform single-level or multilevel
reconstruction, respectively, on the components of one-dimensional signals. These commands
have their two-dimensional analogs, idwt2 and waverec2.

Reconstruction Filters:

The filtering part of the reconstruction process also bears some discussion, because it is
the choice of filters that is crucial in achieving perfect reconstruction of the original signal. The
down sampling of the signal components performed during the decomposition phase introduces a
distortion called aliasing. It turns out that by carefully choosing filters for the decomposition and
reconstruction phases that are closely related (but not identical), we can “cancel out” the effects
of aliasing. The low- and high-pass decomposition filters (L and H), together with their
associated reconstruction filters (L' and H'), form a system of what is called quadrature mirror
filters:

45
Reconstructing Approximations and Details

We have seen that it is possible to reconstruct our original signal from the coefficients of the
approximations and details.

It is also possible to reconstruct the approximations and details themselves from their
coefficient vectors. As an example, let’s consider how we would reconstruct the first-level
approximation A1 from the coefficient vector cA1. We pass the coefficient vector cA1 through
the same process we used to reconstruct the original signal. However, instead of combining it
with the level-one detail cD1, we feed in a vector of zeros in place of the detail coefficients
vector:

46
The process yields a reconstructed approximation A1, which has the same length as the original
signal S and which is a real approximation of it. Similarly, we can reconstruct the first-level
detail D1, using the analogous process:

The reconstructed details and approximations are true constituents of the original signal. In fact,
we find when we combine them that

Note that the coefficient vectors cA1 and cD1 — because they were produced by downsampling
and are only half the length of the original signal — cannot directly be combined to reproduce
the signal. It is necessary to reconstruct the approximations and details before combining them.
Extending this technique to the components of a multilevel analysis, we find that similar
relationships hold for all the reconstructed signal constituents. That is, there are several ways to
reassemble the original signal:

47
Wavelet families:
Several families of wavelets that have proven to be especially useful .some wavelet
Families are
 Haar
 Daubachies
 Biorthogonal
 Coiflets
 Symlets
 Morlet
 Mexicanhat
 Meyer
 Other real wavelets
 complex wavelets

Haar

Any discussion of wavelets begins with Haar wavelet, the first and simplest. Haar
wavelet is discontinuous, and resembles a step function. It represents the same wavelet as
Daubechies db1.

48
Daubechies

Ingrid Daubechies, one of the brightest stars in the world of wavelet research, invented
what are called compactly supported orthonormal wavelets — thus making discrete wavelet
analysis practicable. The names of the Daubechies family wavelets are written dbN, where N is
the order, and db the “surname” of the wavelet. The db1 wavelet, as mentioned above, is the
same as Haar wavelet. Here are the wavelet functions psi of the next nine members of the family:

49
Bi-orthogonal

This family of wavelets exhibits the property of linear phase, which is needed for signal
and image reconstruction. By using two wavelets, one for decomposition (on the left side) and
the other for reconstruction (on the right side) instead of the same single one, interesting
properties are derived.

50
Coiflets

Built by I. Daubechies at the request of R. Coifman. The wavelet function has 2N


moments equal to 0 and the scaling function has 2N-1 moments equal to 0. The two functions
have a support of length 6N-1. You can obtain a survey of the main properties of this family by
typing waveinfo('coif') from the MATLAB command line
.

Symlets

The symlets are nearly symmetrical wavelets proposed by Daubechies as modifications to the db
family. The properties of the two wavelet families are similar. Here are the wavelet functions psi.

51
Morlet

This wavelet has no scaling function, but is explicit.

Mexican Hat

This wavelet has no scaling function and is derived from a function that is proportional to
the second derivative function of the Gaussian probability density function.

52
Meyer

The Meyer wavelet and scaling function are defined in the frequency domain.

Other Real Wavelets

Some other real wavelets are available in the toolbox:


• Reverse Biorthogonal
• Gaussian derivatives family
• FIR based approximation of the Meyer wavelet
Complex Wavelets

Some complex wavelet families are available in the toolbox:


• Gaussian derivatives
• Morlet
• Frequency B-Spline
• Shannon

53
PROPOSED ALGORITHM
A signal as a function of f(t), can often be better analyzed and expressed as a linear
decomposition of the sums: products of the coefficient and function. In the Fourier
series, one uses sine and cosine functions as orthogonal basis functions. But in the
wavelet expansion, the two-parameter system is constructed such that one has
double sum and the coefficients with two indices. The set of coefficients are called
the Discrete Wavelet Transform(DWT) of f(t). Namely called a wavelet series
expansion which maps a function of a continuous variable into a sequence of
coefficients much of the way as fourier series dose with the main useful four
properties. The representation of singularities, the representation of local basis
function to make the algorithms adaptive in-homogenities of the functions, also
they have the unconditional basis property for a variety of function classes to
provide a wide range of information about the signal. They can represent the
smooth functions. In the wavelet transform, the original signal (1-D, 2-D, 3-D) is
transformed using predefined wavelets. The wavelets are orthogonal, orthonormal,
or biorthogonal, scalar or multiwavelets. In discrete case, the wavelet transform is
modified to a filter bank tree using the decomposition/reconstruction.
The wavelet transform is a convolution of the wavelet function ψ(t) with the
signal x(t). Orthonormal dyadic discrete wavelets are associated with scaling
functions Φ(t). The scaling function can be convolved with the scale m and
location n can be written as
+∞
𝑇𝑚,𝑛 =∫−∞ 𝒙(𝒕) 𝝍𝒎,𝒏 (t)dt
By choosing an orthogonal wavelet basis 𝜓𝑚.𝑛 (t) we can reconstruct the original.
The approximation coefficient of the signal at the scale m and location n can be
written as
+∞
𝑆𝑚,𝑛 =∫−∞ 𝑥(𝑡) 𝜑𝑚,𝑛 (t)dt

54
But the discrete input signal is of finite length N. So the range of scales that
can be investigated is 0<m<M. Hence a discrete approximation of the signal can be
written as
𝑥0 (t)=𝑥𝑀 (𝑡)+∑𝑀
𝑚=1 𝑑𝑚 (t)

Where the mean signal approximation at scale M is


𝑥𝑀 (t)=𝑆𝑀,𝑛 𝜑𝑀,𝑛 (t)
And detail signal approximation corresponding to scale m,for finite length
signal is given by
𝑑𝑚 (t)=∑𝑀−𝑚
𝑛=0 𝑇𝑚,𝑛 𝜓𝑚,𝑛 (t)dt

The signal approximation at a specific scale is a combination of the


approximation and detailed at the next lower scale
𝑥𝑚 (t)=𝑥𝑚−1 (t)-𝑑𝑚 (t)dt
The wavelet based algorithm has been implemented using MATLAB
software. MATLAB is a high performance, interactive system which allows to
solve many technical computing problems. The MATLAB software package is
provided with wavelet tool box. It is a collection of function built on the MATLAB
technical computing environment. It provides tools for the analysis and synthesis
of the signals and images using wavelets and wavelet packets within the
MATLAB domain.
The discrete wavelet transforms: The approximations are the high-scale,
low frequency components of the signal. The details are the low-scale, high
frequency components. The original signal we could consider as the approximation
at level 0, denoted by A0. The words “approximation” and “detail” are justified by
the fact that A1 is an approximation A0 taking into account the low frequencies of
A0. Where as the detailed D1 corresponds to the “high frequency” correction. The
approximations and details of ECG record are shown.

55
S=A1+D1; A1=A2+D2;
A2=A3+D3; A3=A4+D4;
S=A4+D4+D3+D2+D1

Scale 1 2 3 4
Resolution 1 ¼ 1/8 1/16

56
EXPERIMENTAL RESULTS

57
58

You might also like