EFFICIENT, SECURE AND NOISE ROBUST
DATA ENCODING AND DECODING
WAVELETBASED ALGORITHM
by
Joseph B. Klingman
B.S., The New Mexico Institute of Mining and
Technology, 1996
A thesis submitted to the
Univetsity of Colorado at Denver
in partial fulfillment
of the requirements for the degree of
Master of Science
Electrical Engineering
2002
This thesis for the Master of Science
degree by
Joseph B. Klingman
has been approved
by
OT/JIA
.Date
Klingman, Joseph B. (MS. Electrical Engineering)
Efficient, Secure and Noise Robust Data Encoding and Decoding Wavelet
Based Algorithm.
Thesis directed by Associate Professor Jan Bialasiewicz.
ABSTRACT
Wavelet transforms are essential components of signal processing and
provide mathematical tools for the analysis of timevariant, spacevariant
signals. Naturally occurring signals are good candidates for such analysis.
Although mathematical tools, such as the Fourier transform, are excellent for
signal analysis and decomposition, Wavelet transforms provide utilities for
the decomposition of signals over time and frequency. A fundamental
problem in digital communication is accurate and secure transfer of the
signal from one location to another. The data must be transformed into an
analog signal, transmitted and received. It is intended to transfer a signal
with the possibility of interception by outside entities, while allowing the
receiver to decode it accurately. Before, during or after the signal is
transmitted, the addition of noise must be considered. The decoding of data
requires the removal of all noise, and it requires decoding of the encoded
data, leaving the original discrete data. This process allows for the
transformation of the analog signal into digital data with a low bit error rate.
These objectives are achieved in an algorithm developed here in, and is used
in
as the basis for a graphical user interface, which encodes digital data,
transmits the data, and decodes the data leaving the original digital data.
This abstract accurately represents the content of the candidates thesis. I
recommend publication.
Signed
IV
DEDICATION
This thesis is dedicated to my wife, Colleen, and to my daughter,
Alexandria, who endured incessant hours of study and provided limitless
support and understanding.
ACKNOWLEDGMENT
The author wishes to express sincere appreciation to Dr. Jan Bialasiewicz for
his invaluable guidance and unfaltering patience during the study phase of
this material and for his assistance in the preparation of this thesis.
CONTENTS
Figures...............................................................ix
Tables................................................................xi
Chapter
1. Introduction......................................................1
1.1 Summary...........................................................1
1.2 Problem...........................................................3
1.3 Goals and Solutions............................................. 3
1.4 Organization and Features.........................................4
2. Background........................................................6
2.1 Wavelet TimeFrequency Signal Processing..........................8
2.2 Wavelet Equations................................................ 9
2.3 The Morlet Wavelet...............................................12
3. Algorithm Implementation.........................................14
3.1 The Get Data Utility.............................................15
3.2 Calculate Morlet Wavelet Utility.................................16
3.3 Encode Data Utility..............................................20
3.4 Add Noise Utility............................................... 22
3.5 The Decode Data Function.........................................25
3.6 Signal to Noise Ratio............................................29
4. Operations.......................................................31
4.1 Graphical User Interface.........................................31
4.1.1 Input Parameters...............................................32
4.1.2 Encode Data....................................................34
4.1.3 Energy Detection & Noise Rejection.............................37
4.1.4 Bit Recovery...................................................38
5. Conclusion.......................................................43
Appendix
A. Matlab Computer Programs...........................................45
vii
Bibliography.
59
viii
FIGURES
Figure
1.1 1 A Morlet Wavelet...............................................2
2.2 1 TimeFrequency Representation of Energy [3]...................12
31 Algorithm Flow Diagram...........................................14
3.2 1 The Morlet Wavelet Utili ty...................................17
3.2 2 Create and Plot Boxes Utility.................................18
3.2 3 Rectangles Representing Energy................................19
3.3 1 Create Basic Wavelet Utility..................................21
3.3 2 The Encode Data Utility.......................................21
3.3 3 Encoded Data..................................................22
3.4 1 Noise Slider Graphical User Interface.......................23
3.4 2 ThesvcbackFunction..........................................24
3.4 3 The Add Noise Utility..................................... 24
3.4 4 Noisy Encoded Data............................................25
3.5 1 The Decode Utility............................................28
4.1 1 The Graphical User Interface..................................31
4.1.1 1 Discrete Data Representation................................33
4.1.2 1 Encoded Discrete Data.......................................36
IX
4.1.22 Noise Added to Encoded Data...................................36
4.1.4 1 Encoded Data with Reduced Noise..............................40
4.1.4 2 Increased Noise Level........................................41
x
TABLES
Table
3.11 Binary Matrix Data File....................................16
4.1.4 1 Decoded Data............................................41
4.1.4 2 Decoded Data Degradation................................42
XI
1. Introduction
1.1 Summary
Many applications require analog signals be transmitted and received, where an
analog signal is a continuous waveform generated either by natural means or
generated synthetically. Analog signals are produced from such sources as speech,
music and video signals. The signal carries information which, by utilizing signal
processing methods, can be extracted and utilized. The method of information
extraction depends on the type of signal and the nature of the information carried by
the signal. Signal processing is concerned with mathematical representations of the
signal and algorithmic operations used to extract information from the signal. In
some cases representing the signal in a transformed domain benefits signal
processing. In the case of discrete time signals, it may be easier to extract data from
a signal in the frequency domain rather than the time domain. When the signal is
represented as stationary in time, ideal mathematical tools to transform the signal,
such as the Fourier transform, are available.
Many signals are dynamic over time and can be represented as such by
transforming, or decomposing, the signal into smaller parts. These parts are known
as atoms and allow us to analyze simpler parts of the signal which, in whole, make
up the entire signal. The atoms can be represented on the timefrequency plane, and
can be scaled to represent changes in energy along the signal. Utilizing the wavelet
method, localization of the signal can be accomplished very efficiently and the
wavelets represent discontinuities very well.
1
Digital data can be transformed into the continuous domain using wavelet
transforms. A wavelet, representing a single bit of data, stretches, contracts and
translates over time, depending its scale. Figure 1.11 illustrates a single
decomposition of a signal using wavelet methods. Wavelets transform one
dimensional data into two dimensions, time and frequency. Wavelets decompose
each part of the discrete signal into small sections of energy. This energy signal is
represented as a continuous waveform, whose magnitude represents the frequency
of the signal.
Figure 1.11 A Morlet Wavelet
Contraction and dilation of the Wavelet is accomplished by changing the values of
Scale (s). For s > 1, larger values contract the wavelet in time and dilate the wavelet
in frequency. Wavelet signals are recovered utilizing knowledge of the wavelet
transforms. That is, the Continuous Wavelet Transform (cwt) is invertible.
2
1.2 Problem
Efficient transmission of a digital signal without interception by outside parties is a
condensed summary of the problem. This secure transmission is accomplished with
satisfactory throughput and low bit error upon decoding. This accomplishment
takes into consideration multiple users per channel. The timefrequency domain
depicted in Figure 1.11 can be thought of as a channel, where multiple users, each
utilizing a different frequency, transmit bits of information. Users have the
flexibility to transmit data at different times, and the channel is made of many bits
of data along the timeline. The wavelet approach parses the timefrequency region
into smaller atomic parts.
L3 Goals and Solutions
Parsing the timefrequency region into smaller atomic parts allows for the
application of wavelets to these individual parts with lower probability of error,
lower bit error rates, higher throughput, and higher security. The solution involves
encoding digital data into an analog signal, adding noise to the signal, sending the
signal to the receiver, and decoding the signal back into the original discrete data.
This paper demonstrates a computerbased algorithm which provides a solution for
these goals. The algorithm shows multiple users accessing the channel, it shows the
encoded data, and it shows the decoded data with a minimum bit error rate. There
are two main areas of development. The first is the Encoding of data for every user
who accesses the channel and the adding of noise to more accurately represent
transmission, and the second is the recovery of the transmitted information with a
low bit error rate. Encoding is accomplished by decomposing the data into atoms,
analyzing the data, then rebuilding the data. The atoms are represented on the
3
channel, in time and frequency, and the channel allows for the representation of
bandwidth for each user. Using wavelet transforms, this data is represented in the
time domain as continuous waveform. After the discrete data is decomposed on the
channel, each part is then transformed into a wavelet and summed to represent an
analog signal. Decoding occurs after the analog signal has been transmitted.
Intended or not, transmitting the signal always includes the addition of noise to the
signal. If the addition of noise is not intended, computer hardware, wires and
transmitting devices naturally add noise to the signal. From the point the signal
leaves the transmitter to the point of receipt, the signal, in all probability, will pick
up noise. Often times it is necessary to add noise to the system. Examples include
communications involving military, business and Internet applications, requiring
secure transmission. Regardless of the noise level, in order to receive an accurately
transmitted signal, this algorithm requires that the signal be decoded. If the discrete
data is encoded with a wavelet, it follows that the encoded signal can be decoded
and digitized utilizing wavelet transforms. The wavelet computes the continuous
wavelet coefficients, and these coefficients are compared to threshold values and
used to determine the original discrete data. If the locations of the original atoms
are known within the timefrequency channel, then the coefficients can be used to
correlate the transmitted signal with discrete data and a new, but equivalent, discrete
data file can be built.
1.4 Organization and Features
What follows is a presentation of the Efficient, Secure and Noise Robust Data
Encoding And Decoding WaveletBased Algorithm. A short background and
history of the wavelet introduces the concepts. In order to completely explain
wavelets, a general understanding of the wavelet equations is shown. Several types
4
of wavelet transforms are in existence, however, for use in the Efficient, Secure and
Noise Robust Data Encoding And Decoding WaveletBased Algorithm, the Morlet
wavelet is introduced. The algorithm is written in the Matlab technical computing
language. The third section describes encoding and decoding algorithms in detail.
Each section of the Matlab programming language is shown along with detailed
explanations for each section. This demonstrates how the discrete data file is
retrieved, how the Morlet wavelet is calculated, how the data is encoded and finally
how it is decoded. The Operations section shows how the graphical user interface is
used and how the algorithm is implemented. This section demonstrates the
algorithms ability to decode data at a low bit error rate, how the user can control
the bit error rate, and it demonstrates where the algorithm begins to fail when an
excessive amount of noise is added to the transmitted signal.
5
2. Background
Wavelets first appeared in 1909 and, to a great extent, much of the work in
Wavelets was accomplished in the 1930s. However, in the early 1800s, one of the
most significant contributions leading to wavelet theory was Joseph Fourier and his
theories of Fourier synthesis developed in 1807[2]. His theories opened new ideas
for mathematics and functions. He showed that any periodic function/ (x), with
27t period multiples, is equal to the sum:
cos kx+bk sin kx) (21)
where
(2.2)
1 2*
ak= j/(x)cos(Ax)<&,
ft A
(2.3)
1 2?r
bk= J/(x)sin(fo)rfr,
ft A
(2.4)
After this theory was introduced, mathematicians were inspired to begin researching
functions and their meaning; they explored Fourier series in depth; and they
developed new concepts. Eventually, the studies of this frequency analysis lead to a
new idea, that is, the idea of scale analysis. The idea is to create mathematical
functions and shift them in time, for example, and change their scale. Scale is
6
analogous to magnitude. However, if the functions scale of frequency changes, so
will its time period, leaving the overall energy of the signal unchanged. One benefit
of scale analysis is that, if it is repeated many times, it allows for the summation and
average of the function at many different scales. If the function turns out to be a
communications signal, it would be less sensitive to noise because average changes
in the signal are measured at different scales. This idea was the basis for wavelets
and first emerged in A. Haars thesis in 1909. Haars wavelets are not continuously
differentiable which somewhat limits their applications [2]. In the 1930s,
mathematicians and scientists began to research the application of varying scale to
functions. The Haar wavelet was applied to such functions as random signals and
energy functions.
Between 1960 and 1980, Weiss and Coifinan applied wavelets to the most basic
elements of functions, called atoms. Their goal was to be able to reconstruct the
many atoms of a function. In 1980, Grossman and Morlet, a physicist and an
engineer, paved a new way of thinking about wavelets based on physical intuition,
by defining wavelets in the context of quantum physics. Today, Stephane Mallat,
author of the text A Wavelet Tour of Signal Processing, applies wavelets to digital
signal processing and Meyer constructed the first continuously differentiable
wavelets. Most recently, Ingrid Daubechies constructed a set of wavelet
orthonormal basis functions, based on Mallats work, and some say may be the most
elegant of wavelet applications today.
After several years of field work Morlet in 1972 devoted all his efforts to enhancing
the resolution of seismic events while processing field data. By the mid'70s, he
developed a technique he called "cycleoctave transform," which is now the
7
universally accepted "wavelet transform." Following in the footsteps of Denis
Gabor, Morlet was puzzled by the poor results he obtained but was persistent.
Morlet kept the constraint resulting from the uncertainty principle applied to time
and frequency, but he perceived that it was the wave shape that must be invariant to
give uniform resolution in the entire plane. By 1975, he adapted the sampling rate to
the frequency, thereby creating, in effect, a changing time scale producing a
stretching of the wave shape. Today the wavelet transform is also called the "time
scale analysis" approach, which is comparable to the conventional timefrequency
analysis [4].
2.1 Wavelet TimeFrequency Signal Processing
Many real world signals are analog in nature, and in order to apply analog signals to
computers, they need to be converted to discrete data. The encoding and decoding
waveletbased algorithm presented in this thesis begins with digital data; it encodes
the signal by converting the data to analog. Encoding is the process of constructing
signal from the user data, or bits, and transforms the data into a signal unlike the
original data and unknown to any unwanted recipients of the signal. Noise may also
be added to the signal, either synthetically before transmission or naturally during
transmission. The algorithm decodes the data by applying wavelets to convert the
analog signal back into a digital signal by removing noise from the received signal.
Decoding is the process of recovering the original user data from the transmitted
signal.
The algorithm begins to take on yet more useful applications when multiple users of
a certain channel are taken into consideration. The channel is based on a range of
8
frequencies, and at certain frequencies, a digital signal is fed through the channel.
This process is termed multiple access. Users transmit^) bits, where k=l,2,3...N,
and N is the number of users. This translates to the total number of bits through the
channel as (bk )k=l (3). If the channel is thought of as a timefrequency region, the
region can be broken up into smaller parts, where there is a lower error rate, a higher
level of security, and a higher throughput rate. These smaller parts of the waveform
are defined by small bursts of energy over a partitioned time period. Thus, the term
wavelet applies to this definition.
2.2 Wavelet Equations
A wavelet begins with the summation of many parts of the signal. If the wavelet is
represented as % then the wavelet can be summed using:
oo
JV(0<# (25)
When scale (s) is applied to this function, the wavelet can be dilated or contracted
along the timefrequency channel. If the wavelet is dilated in time, it is
subsequently contracted in frequency. Likewise, if the wavelet is contracted in
time, it is subsequently dilated in frequency. The function, or wavelet, can also be
translated by (u). This translation is a time shift, and as a result, the wavelet can
change its magnitude in time and frequency, at any point in time within the channel.
If (t) represents time, then the basic wavelet becomes:
v=TsÂ¥ I
tu
s
(2.6)
9
If we let y/r be a defining wavelet called a basic wavelet, wavelet atoms can be
defined by how much each atom is dilated and translated.
The center of the probability distribution, (/)2, is given by
w
ur = WM
dt
(2.7)
Second, the variance [3] around ur is given by
r,200 = dt
(2.8)
This gives an indication of how probable it is that energy is focused near the center
point of the wavelet. The center frequency (Â£) is therefore defined by
t,r =^ (o)j dot), and the wavelets spread [3] around the center frequency is
J(*> 4r )'K()2 ^
(2.9)
At any point in time, the following function can be applied to the signal f(t):
(2.10)
10
This can be written as a convolution:
Wf(u,s) = f*\j/S(u),
(2.11)
where
1 (tu\
(2.12)
Wf(u,s) gives the variation of/in the region of (u). The value of W(u,s) depends on
the location of energy of y/U:S. In time, y/u,s is centered at (u, n/s) with a dilation
proportional to the scale (s). This energy is represented as a rectangle, shown in
figure 2.21. In this figure, the concentration of energy on the (t, co) axis changes
with the rectangle position and scale, while the magnitude of energy remains the
same. represents the frequency interval size, and at represents the time interval
size. The wavelets energy is concentrated in a frequency interval, defined by the
rectangle, whose size is scaled by s in the time axis and 1/s in the frequency axis.
When s varies, the height and width of the rectangle change size, but its area
remains constant.
For each atom, centered at (u, 4), in the timefrequency plane, the energy
distribution of (f) is given by:
2
(2.13)
11
Figure 2.21 TimeFrequency Representation of Energy [3]
2.3 The Morlet Wavelet
Although there are several different types of wavelets, the encoding and decoding
waveletbased algorithm utilizes the Morlet wavelet. This wavelet is useful for
specifying wavelets in the timefrequency domain, using the parameters of center
frequency (Â£) and bandwidth, (a^). There are two more advantages of the Morlet
wavelet; it supports the entire frequency axis, rather than only intervals, and it is a
modulated Gaussian function. The form of the Morlet wavelet is:
i
(2.14)
12
where y/^ is the maximum value, and aa = Jo . The Morlet Wavelet
contains exponential decay in both time and frequency, which makes it optimal for
the encoding and decoding waveletbased algorithm.
The Morlet function is represented in equation 2.16 below.
Â¥'=Tsw
Uu''
\ S J
= ")/i)J/2 cos(co(tu)/s)
Js
(2.15)
This equation is exponential in time, t, translated by u, with frequency a> and scale
W.
13
3. Algorithm Implementation
There are eight parts to the Data Encoding and Decoding Wavelet Based Algorithm.
Figure 3.1 demonstrates the algorithm flow. The algorithm begins with an ASCII
text data file and is a matrix of binary data; each column in the matrix represents
data at a particular center frequency, and the number of rows determines the number
of rectangles for each center frequency. An MxN matrix is represented as N center
frequencies, each containing Mrectangles. Each one in the matrix indicates a
command to the algorithm and the algorithm calculates a wavelet. A zero
indicates that no frequency is passed to the algorithm, or added to the encoded
signal. Figure 3.1 shows the high level nature of the algorithm flow diagram.
Figure 3.1 Algorithm Flow Diagram
14
3.1 The Get Data Utility
The Get Data function of the algorithm simply opens the ASCII text data file
containing the matrix of binary data and reads the data into the current instance of
the algorithm. If the user changes the binary matrix in the data file, then the
algorithm reads the new data when the data is plotted. The Get Data function closes
the data file when it is finished reading the data, and the binary matrix is fed into
another array, indicating the size of the data matrix. Table 3.11 shows how the data
file is organized. The table can be any (MxN) elements and is only limited by
algorithm or machine performance.
15
Table 3.11 Binary Matrix Data File
110
111
110
10 0
10 0
0 0 1
0 10
10 0
0 0 0
0 0 1
0 10
10 0
0 0 0
0 0 1
0 10
10 0
0 0 0
0 0 1
0 10
10 0
0 0 0
0 0 1
0 10
10 0
0 0 0
0 0 1
0 10
10 0
3.2 Calculate Moilet Wavelet Utility
The Calculate Morlet Wavelet algorithm calculates the wavelet for each data point
in the array, and the results of this part of the algorithm are independent of the data
encoding portion of the algorithm. The Calculate Morlet Wavelet algorithm is used
to formulate a basis for determining the size of the rectangles. It calculates the
center frequency (Q, the bandwidth (am), the time center (u) and the time width (
for each data point. This data is used in the Create Boxes utility. This utility finds
the start and end point of every rectangle. For every rectangle, x is defined as the
16
start point in time, y is defined as the start point in frequency, w is defined as the
width of the rectangle in time, and Vz is defined as the bandwidth of the rectangle.
If 4, crta, u and a, are known from the Calculate Wavelet algorithm, then = (u
(cr,/2), y=(Â£(cJa/2), w=cr,and h=\crm\. Each of these values is put into an array,
which represents an array for every data point. There is an array for the x, y, w and
h points. Adding small values to every value of o^can control separation between
each rectangle. The Create Boxes utility also plots the center frequencies of each
data point. If the data point is a zero, a o is plotted. If the data point is a one, a
is plotted. This allows the user to easily distinguish the data in graphical format and
it indicates the exact location of (
wavelet is calculated in the Matlab language, and figure 3.22 demonstrates how the
wavelet values translate to create rectangles.
Figure 321 Hie Morlet Wavelet Utility
M M * * * + * + * M *
for k=l:size(s,2)
ws (k) =Wo/s (k) ;
Bs (k) =Bo/ (s (k))
f (k) = (ws (k) /pi) ;
T(k)=l/f (k) ;
Calculate tne fccriet Waveiet
iterate number of columns in the initial center freq, each rev? cf initial value of BW for rows of % find the frequency value T(k. % a temporary value of time. dataFile.m dataFile.m, dataFile. m, )
CenterFreq s Bar.cbf id th
Â£ for the Morlet v;avelet t for the Sterlet wavelet
t wavelet.
sigmaw=(Bs(k)/pi);
ql(k) = (T(k) bU/sO
pl(k)=((ql(k)A2)/2),
% calculate the Motif
morl (k) = (l\sqrt(s(k)))*(exp(pi(k))).*cos(5.*ql(k) );
sigmat=abs (morl (k) *s (k)) , * TirceWidth
u= ( T (k) + (sigmat/2) ); $ Tiir.eCer.ter
17
Figure 322 Qeate and Plot Boxes Utility
+ BOXSS **** + **Tffj*TTr**T?s + ST'r?ATfJ: + rs*
V Find t'ne start and end coin
x=(u(sigmat/2))* (s (k) ) ;
y=( ( zeta(sigmaw/(2)) ) );
w=abs(sigmat)* (s (k) ) ;
h=(abs(sigmaw));
of boxes
Z time start point of the first
t frequ start point of the first box
i the width of the first box in time
V the 'width of the first box in frequency
r.1 nr r
oks and columns of incut dataFile as Boxes
if (colCntr == k)
Column=dataPile(:,colCntr);
v = u*(s(k)) ;
while (rowCntr <= dataSize(l))
Elmt=Column(n);
x= (v (w/2) ) ;
xA (rowCntr, colCntr) =x;
wA(rowCntr,colCntr)=w;
cxA(rowCntr,colCntr)=x+(w/2);
trans=wA(rowCntr,colCntr)+1.5;
$ Column is a vector =
i set Time Center= nsv;
to column(k!
variable, \
'l
value of each element in the column,
find x based on v.
put all x's in array
'4 cut ail w's in array
% put center of boxes in an array
Control secaration b/w boxes.
t Plot Center Frequencies of Boxes
if ( (w+x) < max(max(et)) ) s if the box is in the time range
rect=(rectangle(1 Position1, [x y w hj)); % figure rectangle
4pict the rectangle on a log scale.
semilogy(rect*.02); xlabel('Time'); ylabel('Frequency');
if (Elmt == 0)
plot(v,zeta,'bo');
else
plot (v, zeta, b*);
end
end
v = v + trans;
oldMor = mor;
oldet = et;
n=n+l;
rowCntr=rowCntr+l;
end tend while rowCntr <= dataSize(l)
colCntr = colCntr +1;
rowCntr=l;
n=l;
end i end if (colCntr == fcj
end fe end for k=l: size ; s, 2)
1 if 'O' plot a 'o'
% else, plot a ''
18
Figure 3.23 represents energy as a rectangle. The concentration of energy on the
(t,co) axis changes with the rectangle position and scale, while the magnitude of
energy remains the same. am is the frequency interval size, or bandwidth, and atis
the time interval size. The wavelets energy is concentrated in a frequency interval,
defined by the rectangle, whose size is scaled by (s) in the time axis and (1/s) in the
frequency axis. When s varies, the height and width of the rectangle change size,
but its area remains the same. In order to demonstrate this, figure 2.21 is drawn on
a linear scale axis, however, so that the rectangles are shown at a constant height,
figure 3.23 is drawn with a frequency axis on the log scale [1]. Figure 3.23
represents energy for Is and Os. An 'o' represents a 0 data point and a represents
a 1 data point. Each data point is represented at a certain center frequency and
center time point.
Figure 3.23 Rectangles Representing Energy
19
3.3 Encode Data Utility
The encode data utility, represented in figures 3.31 and 3.32, is the main part of
the algorithm and utilizes equation 2.16. In the Matlab algorithm the variable b is
the translation in time, b = (Boxslarl +~Boxwldlh), and it is the center of each
rectangle. The value a is considered the scale, and it changes for every center
frequency. The variables p and q are intermediate variables to ease program
readability, and they hold the values of time minus translation divided by scale. If
the element is exactly equal to the first rectangle and the rectangle lies completely
within the specified time range, then the Morlet wavelet is calculated for the first
rectangle. The rectangle parameters are used to calculate the wavelet results and the
algorithm uses one large matrix to capture the rectangle data, sum the data and plot
the wavelets. The encode data utility transforms the data into an analog signal and
transfers the signal. This is demonstrated in the graphical user interface by plotting
the data against time and correlating the signal with the rectangles. For all rows and
columns of data, the utility places the Morlet wavelet data of every rectangle in an
array called allMor. The length of the allMor array is the same length as the
time span shown in the graphical user interface, so the values of the calculated
Morlet wavelet for each Heisenberg Uncertainty box is place at the appropriate
time, and zeros are elsewhere.
20
Figure 331 Create Basic Wavelet Utility
>xx**x*,x****sr*x***,*x,*x*x* Mq 2T1 g t V? a\re T t t j***iiTi[H******itxi*T*j[
b= ((x+w) w/2) ;
a= (y/(y+h) )*s(k)
q=(etb)/a;
p=((q.a2)/2) ;
* the translation, b
% seal .6
for the morlet wavelet equation
? for the morlet wavelet sanation
% if element in the datafile is a 1 s it exists w/in the channel
ri find the Mcrlet waveform for each box
if (Elmt == 1) & ( (w+x) < max(max (et)) )
mor= (1/sqrc (a)) (exp(p)) *cos(5.*q) ;
else
% otherwise just set it equal to zero.
mor=zeros(size(et));
end
Figure 332 The Encode Data Utility
%********* Encode Data (Analog representation of each Box; *********
if rowCntr > 1 Put ail moriets in an array
allMor(colCntr :)=allMor(colCntr,:)+mor;
else
allMor(colCntr :)=mor;
t Put all morlets in an array
end
Figure 3.33 shows the encoded data file plotted in analog form, utilizing the Morlet
wavelet transform. This represents the data with no noise added to the signal.
21
Figure 333 Encoded Data
3.4 Add Noise Utility
Adding noise to the encoded data begins on the graphical user interface with the
input slider called Noise. The file wgui defines the graphical user interface
(gui), and the definition of the noise slider is shown in figure 3.41. The graphical
user interface is described in detail in section 4.1. When the slider is activated, the
callback svcback is returned to Matlab, where the function in figure 3.42 is called,
and the value appears on the gui, below the slider. The gca function returns a
handle to the current axis, so that the axis that the encoded data is plotted on is
known to the function. The num2str function converts the number obtained from
the slider into a string. The svcback function opens a file, tempi.m and places
the string in that file. Each time the slider is activated, a new number overwrites the
previous number in the tempi.m file, then closes the file. Figure 3.43
22
demonstrates the load utility where the slider value is loaded into the current
instance of the algorithm. This value is placed into the variable AnsNoise, and if
the value is zero, the entire summation of the encoded data, named total, is plotted.
If the value is not zero, the value is put into a function called normmd. This
function returns a matrix of random numbers chosen from the normal distribution
with input parameters 0 and AnsNoise. The function, shown in,
R=normmd(0, AnsNoise, l,size(total,2)) returns a matrix of normally distributed
random numbers. This matrix is added to the encoded wavelet data file total.
Then the entire matrix, with noise or without noise, can be plotted.
Figure 3.41 'Noise' Slider Graphical User Interface
hi = uicontrol('Parentho, ...
'BackgroundColor', [0.847056023529412 0.815686274509804
0.784313725490196], ...
'Callback','svcback', ...
'ListbozTop',0, ...
'Max',0.5, ...
'Position',[20.5 263 44 20], ...
'Style','slider', ...
'Tag','AZslider', ...
'TooltipString,'Add noise to the Encoded Data');
23
Figure 3.42 The 'svcback' Function
%
a
4 'svcbac.m'
Â¥ This function is for the encode data slider values
?.
r=
44%%i4%4mm%m44%%44**m%Vmm4%U4Â¥4SsÂ¥4*:%4%Srim%*4%Â¥i4Â¥4Ss4i4Â¥4
function svcback()
% function call
Hc_az=findobj(gcf,'Tag'('AZslider'); i define a slider object
Hc_cur=findobj(gcf,'Tag',1AZcur); Â¥ put the current value of the
slider obj in Hc_cur.
str=num2str(get(Hc_az,'Value')); Â¥ convert the number to a string
num=get(Hc_az,'Value') ; i put the value of into 'num'
set(Hc_cur, String', str) ; i writes the value to the text be::
fid = fopen('tempim','w') ; Â¥ open the tempi.m file
COUNT = fprintf (fid, Â¥3.3f\n',num) ; % write the value in the file
fclose(fid); i close the file.
Figure 3.43 The 'Add Noise' Utility
7; ** ** w* *r k *** + ** ** ^dd No5 ^e ** **+ + * +**++* * **** *
Â¥ get the noise value from the 'tempi.m' file, comes from the slider in
Â¥ the gui.
load tempi.m;
AnsNoise=templ; $ put that value into a new var called Ar.sNoise
if AnsNoise==0
Â¥ if there is no noise, just plot the total. Required, else F.=Nan Â£
: nothing to plot.
total=sum(allMor);
else
total=sumCallMor); Â¥ if there is noise, add noise to total & plot.
R=normrnd(0,AnsNoise,1,size(total,2));
total=total+R;
end
figure (1) ;plot let, total) ;grid;
24
Figure 3.44 Noisy Encoded Data
Figure 3.44 shows the encoded data file plotted in an analog form, utilizing the
Morlet wavelet transform. This represents the data with noise added to the signal.
3.5 The Decode Data Function
The Decode Data function, shown in figure 3.51, finds the original binary data
from a noise free or noise filled wavelet. For every column of data in the data file,
the function counts to the end of the channels time period, as well as the end of the
last rectangles center point. If, for some point, the difference between the value of
the current point in time and value of the rectangle center is less than a small value,
then that point is called qCnter. qCnter represents the center of the current
rectangle and it is placed into an array called BoxCenElements. The array
BoxCenElements is used as a convenient way to verify that the centers of the
25
rectangles were found. The center point of each rectangle, qCntr, is used in the
continuous wavelet transform (cwt) function. The cwt function finds the
coefficients of the continuous wavelet transform. The cwt function imports the
summed total of wavelet functions in the channel, including any noise added to the
signal, and, by application of equation 3.1, finds the coefficients of the continuous
wavelet transform array.
The coefficient values are measurements of the energy, associated with each
wavelet transform W^s>f. Where, for every wavelet in the timefrequency plane,
and is projected on an wdimensional orthogonal space, where n represents the
negligible. The dependency threshold defining what constitutes large and small
values can be adjusted on the graphical user interface. The coefficient energy
values returned are very small values if the discrete data matrix has a zero value, or
they are very large values if the matrix has a value of one. The dependency
threshold of the large and small magnitudes can be adjusted. The user may need to
adjust the threshold, depending on the amount of noise in the signal. By utilizing a
value imported from a user interface slider utility, the user may select a threshold,
and the algorithm compares each values of the cwt energy array with this
threshold. If the number returned by cwt is equal to, or greater than, the threshold,
then a value of 1 is placed into a new array called Decoded Data. If the value of
the number returned by the cwt coefficient array is less than the threshold value,
(3.1)
is the wavelet coefficient, and y/r is a unit vector. (/) represents the signal
number of wavelets in the signal. If (f, is relatively small, the result is
26
then a 0 value is placed in the Decoded_Data array. By varying the threshold
values, along with the noise value, one can adjust the robustness algorithm given a
certain level of the noise in the signal.
27
Figure 3.51 The Decode Utility
4 'decode.m'
%
V Finds the original binary data from unnoisy or from noisy wavelet.
4 For every column of data in data file, the function counts until the
% end of the channel's time period, counts until the end of the last
4 box's center point. The cwt function imports the total of wavelet
% functions in channel, including any noise added to the signal finds
t the coefficients of the continuous wavelet transform array.
3; The coefficient energy values returned are very small values if the
Si discrete data matrix has a zero value, or are very large values if
4 the matrix has a value of 1. The threshold of the large and small
? value magnitude can be adjusted.
4
*.
5
load temp2 .m;
thresh=temp2;
'The Data is Decoding'
******* tv * * * :v ********** * r>0 ^CCl 8 * "* * *' * *' * "* * * * * * * * *
mCntr=l;
for rowCntr = l:l:dataSize(2)
4fcr every column, do the following.
qCntr=l;
4 set up another counter q.
% while (q <= max Time) s im <= row Site cf cx?.)
% if diff b/w some point in time and value of Box center <.001 &
4 value of Box center >.0001
while (qCntr <= size(et,2)) & (mCntr <= size(cxA,1))
if ((et (qCntr)cxA(mCntr, rowCntr) )<. 0015) & ((et (qCntr)
cxA(mCntr,rowCntr)) > .0001)
v.put el earn t of BoxCentr in an array called BoxCenElmts
BoxCenElmts (mCntr, rowCntr) =qCntr ;
5. Find the coeffier.ts of the wavelet transform 'total'
coef fs (mCntr, rowCntr) =cwt (total (1, qCntr) s (rowCntr) 'morl') ;
if (coeffs(mCntr,rowCntr) >= thresh)
Decoded_Data(mCntr,rowCntr)=1;
else
Decoded_Data(mCntr,rowCntr)=0;
end
mCntr=mCntr+l;
end
qCntr=qCntr+l;
end
mCntr=l ,
end
'Push "Output File" to see the decoded data'
28
3.6 Signal to Noise Ratio
There are several aspects to the determination of Signal to Noise Ratios (SNR).
First, there is the receiver model, which provides an adequate description of the
receiver noise, which accounts for the inherent filtering and modulation
characteristics of the system. The Encode segment of the algorithm provides a
receiver model. Second, we must add the noise to the transmitted signal. The
receiver model accepts the summation of the signal and the noise. The SNR utilizes
average power of both the signal and the noise. SNR is a ratio of the signals power
to the noise power. The average noise power at the receiver is equal to the total area
under the signals power spectral density, or Sx(f). With the signal and the noise
appearing additively at the receiver, the SNR is defined a ratio of the average power
of the signal to the average power of the noise. The signal to noise ratio provides an
intuitive measure for describing the fidelity with which the decoding process
recovers the message signal from the encoded signal in the presence of additive
noise. For such a criterion to be well defined, the recovered message signal and the
corruptive noise component must appear additively at the receiver. In the
Operations section of this paper, specific SNR examples are provided, which
demonstrate the high fidelity of the algorithm. In any case, the following equations
are used in the signal to noise process.
The average power, P, is the total area under the curve of the signal and is given by:
f=js(/)# (32)
29
The SNR is given by:
SNR =
signal
(3.3)
30
4. Operations
4.1 Graphical User Interface
The encoding and decoding waveletbased algorithm is represented by a graphical
user interface. The interface is based on Matlab software and the user interacts with
a combination of the graphics and Matlab command line output. After executing
Figure 4.11 Hie Graphical User Interface
V jFiguie No. 1
Â£3e Â£<8 Tools Wrxfow Het>
Ifiput
Pofamei erf
BEE
Data Fit 
Graph Dala
Encode ,
Data
OjjJjJO5
Note 0 =
Pk* Mortal
' Oocode
Da)a
:0 <   a5
Thresh;', 0 ,
Decode 
Ouput Daia
OS
10
(10'1
10"
10T
7
=jnm=i?=
......................;
20 40
Bd
eo
.100 12)
Matlab, the user enters the command wgui, which is an acronym for Wavelet
Graphical User Interface. Matlab returns the interface as shown in Figure 4.41.
The interface comprises three main sections. The large graphing area in the center
of the interface is used to show how energy of discrete data is distributed over a
finite area along time and frequency. This area represents rectangles in the channel.
31
The top area represents the encoded wavelet data. Discrete data is converted to
continuous analog data by utilizing wavelet transforms. Each wavelet is summed
along the frequency axis and the total is plotted in the top graph area. The top graph
area represents the encoded data that is securely transmitted to intended recipients.
Noise may also be summed in the signal and transmitted. Along the left hand side
of the interface are the controls of the data, and give the user the ability to input
parameters, encode the data, represent energy, and decode transmitted data.
4.1.1 Input Parameters
The Data File control button allows the user to open, manipulate and save the
discrete input data file. The second control button, Graph Data, reads the discrete
data file in the interface by plotting rectangles on the main graphing area and it
brings the discrete data into memory for use by other controls in the interface.
Figure 4.1.11 shows the discrete data represented as rectangles. The data file this
graph represents contains 3 columns of data and each column of data is plotted at
different bandwidths along the frequency axis, as demonstrated in figure 4.1.11.
32
Figure 4.1.11 Discrete Data Representation
V Figure No. 1
Â£Je Â£
1 r
'PaittMteix
,. Data File  .05
Graph Data o L
Encode 1'
i; jisbSw py:
~0 <11 05
Noise:
Plot Model 
u;:.'. .: C ''.i '
Decode Â§ 10 : '.c* : :
... 9 Â£
o o.s
Thresh: 0 
: Decode 
Ouput Oata? 10'1 0
20
40
. 60 
Time
80
100
_____H> 4TCFi lij iT7i u a
120
The first column of data, shown in Table 3.11, is plotted at a center frequency of
approximately 1.31. The second column of data is plotted at a center frequency of
approximately 0.656. The actual values of the center frequencies can be found by
typing the command zetas on the Matlab command line. The center frequency is
based on the equation a>0 =
2n
J
0
Transform of the basic wavelet in equation 2.6. Therefore, the center frequency is
also dependent on scale, or cos= coo /scale. The Bandwidth is represented by the
height of the rectangles along the frequency axis, and is equal to equation 2.11, or
(
centers of each rectangle can be obtained by typing cxA, and each rectangle width
can be obtained by typing widths on the Matlab command line. The bandwidth
33
for each rectangle can be obtained by typing wA. The position of the rectangles
along the time axis is based on the number of rectangles that can fit in the allocated
time range. Since the total energy of the rectangles must remain constant, as the
bandwidth decreases, the time range of that rectangle must increase. As the value of
center frequency decreases, the time range for each wavelet increases. Since there is
only a certain amount of data which can pass thorough the channel in any given
time period, the time range does not change as the number of discrete rows of data
increases. Therefore, the interface represents a defined time period, the decoding
utility decodes data for the given time range and future work may consider
synchronizing continuous bit streams. This work might consider the given time
range of length (n) as a bit packet, process and decode the packet from the indicated
start of the data file to the end of the data file.
4.1.2 Encode Data
The next set of controls in the interface allows the user to encode the data and it
allows the user to add noise to the data. Every discrete data point, and hence every
rectangle represented on the timefrequency axis, is encoded using the Morlet
Wavelet function. This function is represented in equation 4.1 below.
1
T/ l S J
e((' u)!sfn cos(*o(/h)/j)
yls
(4.1)
This equation is exponential in time, t, translated by u, with frequency co and scale
(j). Each column of the discrete data matrix is encoded and placed into a matrix.
This Morlet matrix transposes the data in the data matrix file, and contains the
same number of rows as there are columns in the discrete data file. It has the same
34
number of columns as there are rows in the discrete data file. After the last data
point in the matrix data file is encoded, all the rows in the Morlet Matrix are
recursively summed together. For example, row 2 is added to row 1, then, this sum
is added to row 3 and so on. The total of this sum is plotted in the upper graph area
of. It can be seen, in figure 4.1.21, there are 1s in the discrete data file, and hence
the rectangles, a corresponding wavelet exists in the encoded data. Where there are
zeros, there is no corresponding wavelet. Figure 4.1.21 demonstrates the encoded
data with a zero value for noise. If noise is added to the data, as in figure 4.1.22,
then the value of the noise shown under the noise slider and, after the Plot Morlet
button is pushed, the encoded data, with noise is plotted in the top graph window.
35
Figure 4.1 21 Encoded Discrete Data
I V Figure No. l HEE3I
Â£Be Ed* : Ioc Inputs rr PtfADdCR Data Fie  Graph Dala ibvWndovv !< V *i ! Help; 
' ; 0' ifjl i i i < 1 t I i J I;,:
 c i r .of\ an m .MV .inn ion 1
Encode . ' 10
Data V. 4 I 1 'tlAC ; i 1
iO; U,0
Ndce 0 V.'. i i i t
Plot Model ' i i
\\\ j f i  r r
i io
. Decode/ Data/ ,  '
In a 11 :> I'QS
ruv 1 t 1 *
Thesh o >
 Decode  v j&r/tJ 11*11 i 1 1 1 1 l 1 a
.. Ouput 0ala1 1 1 1 1 I 1 1 1 I 1
) 20 40 V 60 60 100 120
'. v: v i; ... Time
Figure 4.122 Noise Added to Encoded Data
'J Figure No. 1
EJe Â£tfi Took Vmdwr yelp
. 5
Input'
PanmeteR
. Data Fie I
. Graph Dato
0 <11 >105
None: Q.425
: Ft* Model 
Decades
Data
0*11 >o.s
Threstr 0 
Decode I
j Plot the Encoded Data Noise is added lo the data
HE 13
.10'
XU
SEsep
20
40
60
Time
60
100
.120
36
Noise is added to the data by utilizing the Matlab function normmd. It produces a
matrix of random numbers chosen from a normal distribution. The size of normmd
is the same size as the total summation of the encoded signal. This allows the two
vectors to be added together and plotted.
4.1.3 Energy Detection & Noise Rejection
Shown throughout this paper is the concept of energy represented as rectangles.
Utilizing wavelet transforms, this energy is encoded into analog form. The encoded
signal may be transmitted, and once the intended receiver collects it, the signal may
be decoded. Because the encoded signal represents energy, an energy threshold
detector is used to recover the bits from the signal. The energy threshold detector
measures the energy of the wavelet transform (y/u,S(t>) of each rectangle MxN
Region. This region is defined as Rmxn The energy of the encoded signal is:
If ^mxn is greater than a certain constant value, or threshold, then the amount of
energy can be considered equal to the value 1. Otherwise the amount of energy is
determination of energy for each wavelet, however, adjusting the a value may be the
most appropriate method in many cases. The coefficients are very small values if
the discrete data matrix has a zero value, and are very large values if the matrix has
a value of one. The dependency threshold defining what constitutes large and small
values can be adjusted on the user interface.
(42)
considered equal to 0. The constant value threshold can be estimated by a
37
Noise rejection utilizes a threshold concept similar to that of Energy Detection. A
signal is thought of as 2 parts: the first being the encoded signal, and the second
being the noise. The encoded portion is defined by the transformation of digital
data into analog data. Through utilization of wavelet transformation equations the
energy is distributed among known functions. Conversely, the noisy portion of the
signal will spread its energy throughout the timefrequency plane, and the
coefficients associated with the noisy portion of the signal are small compared to
that of the encoded portion. This being known, one can set a threshold, filtering the
noisy data from the encoded data.
4.1.4 Bit Recovery
After the encoded signal, including noise, is transmitted, it must be decoded into the
original discrete data. Bit Recovery must occur with a low bit error rate given
different levels of noise added to the original signal. The Decode Data function
finds the original binary data from the encoded signal, with variable noise levels.
The cwt function is used to find the coefficients of the continuous wavelet
transform. As described in section 3.6, the cwt function imports the summed total
of wavelet functions in the channel, including any noise added to the signal, and
finds the coefficients of the continuous wavelet transform array. The threshold
value that is used to determine which coefficients represent a one can be used to
adjust the robustness of the algorithm. The addition of low level noise to the
encoded signal creates random low level spikes to the original signal, and as such, a
large Threshold level is not required. However, if a large level of noise is added to
the system, larger random spikes are added to the signal, and the threshold may need
to be raised to compensate for higher spikes in the signal. Since noise and encoded
data are additive, where a wavelet exists, a high level of noise creates an even
38
greater frequency. This process requires engineering judgment. Noise is added to
the signal, and an unchanging threshold values produces inaccurate results. The
threshold must compensate for higher magnitudes of noise. Figure 4.1.41 shows a
small noise level, of 0.05, added to the signal, and a Threshold level of 0.027 is
defined. The signal to noise ratio (SNR), as described in section 3.6, is
1.8970e+005, which demonstrates a very high fidelity, and gives an indication that
the decode algorithm should result in very accurate results. After the data is
decoded, the Matlab command line reports the pending status The Data is
Decoding until it is finished decoding and the message Push Output File to see
the decoded data appears. When this button is selected Matlab prints the output
data matrix Decoded_Data. The output is shown in Table 4.1.41, and the
(
decoded data is very accurate. The noise level increased to 0.395, as in Figure
4.1.42, the Threshold level is increased to 0.245. The signal to noise ratio (SNR),
as described in section 3.6, is 76.5486, which demonstrates a lower, but still, fair
fidelity. This result gives an indication that the decode algorithm should result in
fair results.
39
Figure 4.1.41 Encoded Data with Reduced Noise
E3e Etfl Iools Window Help
V Figure No. 1
, '"Input .Poiasel'eiST :;'i.ay:2r
. Dele He  o
. Grech Dete
Encode'. Ude; TOj
0 0.5 Noise i 0 (5^
. Plot Model 
.7; ; V.
Decode p .5 10
0 <  >p.5 Thrh:r 0
Decode 
0i4>ut0ata 101 0
HEE3
m
.. 2D
40;
60 /:
Time
;B0
TOO .120
40
Table 4.1.41 Decoded Data
Â£*: Â£* View Wndow glp''.
. D eS ! S& :B i ; ffl :8 i to
Decoded. _Data 
1 1 0
1 1 1
1 0
1 O 0
1 n 0
0 o 0
a o
*i o 0
o o 0
o 0 0
o 1 0
I o O '
a 0 0
o o 0
o o 0
i o 0
o 0 0
0 D e
0 0 0
1 0 0
0 o o
o o o
o o 0
1 o 0
o o 0
0 0 0
o o 0
1 o o
a o o
o 0 0
o o 0
o o 0
o 0 0
o o 0
o o o
0 0 0
o o 0 _l
o o e 
< I 1 1
 y~. . r
Figure 4.1.42 Increased Noise Level
V Figure No. 1
Fie loot Window Help
5
Input
Peiamten
Date.Efe;
Graph Date
Encode
Data
0 <1 >ft5
Noise; ;0.395
Plot Moriet 
' Decode
Data
0 < >0.5
Thiesh 0
Decode 
Oupii Dala
1 10
10
BEE
n IQ 3132 J t or t
4Q
23
40
eo
Time
60
100
120
41
It can be seen from table 4.1.42, that the bit error rate is fairly accurate. However,
in the third column it can be seen that a 1 exists in the first row, where there
should be a 0. If the Threshold level is adjusted up or down, the decoding
algorithm begins to fail in other locations of the matrix. Therefore, the amount of
noise is quantifiable. However, overall the algorithm is very good at determining
the original discrete data from the noise embedded encoded analog transmission.
Table 4.1.42 Decoded Data Degradation
42
5. Conclusion
Wavelet transforms provide the ability to parse the timefrequency domain into
smaller atomic parts, allowing for the decomposition of discrete data into smaller
units of energy. These units of energy are distributed over the timefrequency
domain and are represented as rectangles, which characterize the localization of
energy. Wavelets functions are not only used to find these units of energy, but are
also used to transform these units of energy to analog form. This transformation
encodes the discrete data in preparation for transmission. Before, or during
transmission, the encoded signal will acquire random spikes of energy, or noise. It
has been shown that the intended receiver of the signal can employ wavelet
transforms and threshold values in the decoding process, and the receiver can reject
noise in the signal, leaving the original discrete data. By adjustment of the noise
level and by adjustment of the decoding energy threshold level, an optimal
combination of these parameters is found. This combination will reveal the original
data, while compensating for certain noise levels, with low decoded bit error rates.
These concepts take into consideration multiple users per channel. A portion of the
timefrequency domain can be considered a channel, where multiple users, each
utilizing a different frequency, transmit bits of information. This paper implements
the solutions to the abovedescribed problems in an algorithm. There are eight main
parts to the algorithm including the binary matrix data file and the Get Data utility,
which retrieves the data. The Calculate Wavelet utility finds the wavelet, finds the
center frequency and bandwidth of each data point, and finds the time range of
energy distribution. Once the wavelet and energy distributions are known, the
algorithm finds the beginning and ending points for each rectangle and it plots the
rectangles in the timefrequency domain. The Encode Data utility utilizes wavelet
functions, and the discrete data is encoded into an analog signal. The Decode Data
43
utility not only transforms the encoded data into its original discrete form, but it also
filters any noise associated with the transmitted signal. The Decode Data utility
uses wavelets to transform the signal. It is shown that there are limitations to the
decoding utility, and a combination of noise level and energy threshold level is
necessary to avoid high bit error rates. Noise exceeding particular levels, depending
on the amount of data and energy thresholds, produces errors at any threshold.
Nominal, acceptable levels of noise, however, are well within reach of low bit error
rates for this algorithm. The algorithm provides a graphical user interface as only
one application for these utilities.
44
APPENDIX A Matlab Computer Programs
45
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%
%
% 'Analog, m' Plots the Analog version of the dataFile utilizing wavelet transforms.
%
% This file imports binary data from another file (dataFile.m). This file creates
% arrays for each column of data and computes the start and end location for each
% box per column of data. Then each box is represented as analog Morlet Wavelets.
% The wavelets are added together to for a continuous transformation for all boxes
% as analog.
%
%
%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
dear
load dataFile.m % Go to the matlab file named 'dataFile.m'' and bring
the data into memory.
dataSize=[size(dataRle,1) size(dataFile,2)]; % put the size of the dataFile into another array.
scale=1.213
s=1:l:dataSize(2):
s=s*scale
stepSz=.001;
et=0:stepSz120;
set Scale and time period (ei) step size. *"*"
% 'scale' is a constant value multiplier
% 's' is just a counter up to the number of columns in the dataFile
% now make s some multiple of scale.
% a constant step size, allowing us to easily change this value throughout the program
% et is time.
" Set up global array variables
ws=zeros(1 ,size(s,2));
Bs=zeros(1 ,size(s,2));
f=zeros(1,size
zetaszerosfl ,size(s,2));
xA=zeros(1 ,size(s,2));
wA=zeros(1 ,size(s,2));
ocA=zeros(l ,size(s,2));
widths=zeros(1 ,size(s,2));
BoxCenElmts=zeros(l ,size(s,2));
% initialize array of zeros fen
% Center Frequency
% Bandwidth
% frequency
% Center Frequency V
% x point or start of box
% width of box in frequ
% center of box in time
% width of box in time
% the elements at box center
mor=zeros(1 ,size(et,2));
allMor=zeras(1 ,size(et,2));
zeta =0;
sigmaw=0;
y=0;
h=0;
% Morlet
% Morlet for each column of data in dataFile
% CenterFreq
% Bandwidth
Initialize other variables
LstBoxEndPnt=0;
rowCntr = 1;
colCntr= 1;
n=1;
b1=0; .
Wo=5;
Bo=1.701;
% Last Box End point
% Count number of rows
% Count number of columns
% init n, a counter
% initial offset
% initial frequency
% initial bandwidth
For B0xes Only: Calculate the Monet Wavelet
fork=1:size(s,2)
ws(k)=Wo/s(k);
% iterate though the number of columns in the dataFile.m
% find initial value of center frequency for each rcw of the dataFile.m, base on s(k)
46
Bs(k)=Bo/(s(k));
f(k)=(ws(k)/pi);
T(k)=1/f(k);
% find initial value of bandwidth for each row of die dataFile.m, base on s(k)
% find the frequency value (only used for T(k)
% a temporary value of time.
zeta =( (ws(k))/pi); % CenterFreq
sigmaw=(Bs(k)/pi); % Bandwidth
q1 (k)=(T(k)bl )/s(k); % for the Moriet wavelet
p1 (k)=((q1 (k)A2)/2); % for the Moriet wavelet
% calculate the Moriet wavelet
mor1 (k)=(1\sqrt(s(k)))*(exp(p1 (k))).*cos(5.*q1 (k));
sigmat=abs(mor1(k)*s(k)); % TimeWidth
u=( T(k)+(sigmat/2)); % TimeCenter
^*nmwm>vtnw*T 0r63t6 BOX0S ******,,*****^***,r,**^"******>,,'r***>*11
% Find the start and end point of boxes
x=(u(sigmat/2))*(s(k)); % the start point of the first box in time
y=( (zeta(sigmaw/(2)))); % the start point of the first box in frequency
w=abs(sigmat)*(s(k)); % the width of the first box in time
h=(abs(sigmaw)); % the width of the first box in frequency
% rows and columns of input dataFile as Boxes
if (coICntr == k)
Column=dataFile(:,colCntr); %
v = u*(s(k));
while (rowCntr <= dataSize(1))
Elmt=Column(n);
x=(v(w/2));
xA(rowCntr,eolCntr)=x;
wA(rowCntr,colCntr)=w;
cxA(rowCntr,colCntr)=x+(w/2);
trans=wA(rowCntr,colCntr)+1.5;
v = v + trans;
Column is a vector exactly equal to the cciumn(k). This increases the column number
% set the Time Center, equal to a new variable, v
% Elmt is the value of each element in the column.
% find x based on v.
Vo Store all x's in an array the same size as the dataFile array
% Store all w's in an array the same size as the dataFile array
% Store all center of boxes in an array the same size as the dataFile array
% Control seperation between boxes.
%'
Plot Moriet waveform
b=((x+w)w/2); % the translation, b
a=(y/(y+h))*s(k); % scale
q=(etb)/a; % for the moriet wavelet equation
p=((q.A2)/2); % for the moriet wavelet equation
if (Elmt == 1) & ((w+x) < max(max(et))) % if the element in the dataFil is a 1 & it exists w/in the channel
mor=(1/sqrt(a))*(exp(p)).*cos(5.*q); % find the Moriet waveform for each box
else % otherwise just set it equal to zero.
mor=zeros(size(et));
end
%*"* Analog representation of each Box) *"**
if rowCntr > 1
allMor(colCntr,:)=allMor(colCntr,:)+mor, % Put all moriets in an array
else
allMor(colCntr,:)=mor. % Put all moriets in an array
end
oldMor = mon
oldet = et;
n=n+1;
rowCntr=rowCntr+1;
end %end while rowCntr <= dataSize(l)
coICntr = coICntr+1;
rowCntr=1;
n=1;
end % end if (coICntr == k)
47
end % end for k=l ;size(s,2)
****** aw NO)S 1 "***!WTKi
load tempi.m; the gui. % get the noise value from the 'tempi .m' file, comes from the slider in
AnsNoise=temp1; if AnsNoise==0 % put that value into a new var called AnsNoise
total=sum(allMor); else % if there is no noise, just plot the total. Required, else R=Nan & nothing to plot.
total=sum(allMor); R=normmd(Q,AnsNoise,1,si2e(total,2)); total=total+R; end figure(1 );plot(et,total);grid; % If there is noise, add noise to total & plot.
48
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
%
% 'boxesl .m'
%
% This file imports binary data from another file (dataFile.m) and plots
% boxes. Each column of data is displayed as a row of boxes.
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
dear
0/}m**mi***nt**Mn** GET DATA 1****,l^t*<, **+ >Â¥THmi
load dataFile.m % Go to the matlab file named "dataFile.m" and bring
the data into memory.
dataSize=[size(dataFile,1) size(dataFIIe,2)]; % put the size of the dataFile into another array.
scale=1.213
s=l:1:dataSize(2);
s=s*scale
stepSz=.001;
et=0:stepSr120;
set Scale and time period (ei) step size.
% 'scale' is a constant value multiplier
% 's' is just a counter up to the number of columns in the dataFile
% now make s some multiple of scale.
% a constant step size, allowing us to easily change this value throughout the program
% et is time.
Set up global array vanables
>***#*********
% initialize array of zeros for
ws=zeros(1 ,size(s,2));
Bs=zeros(1 ,size(s,2));
f=zeros(1,slze(s,2));
zetas=zeros(1 ,size(s,2));
xA=zeros(1,size(s,2));
wA=zeros(l ,size(s,2));
cxA=zeros(1 ,size(s,2));
widths=zeros(1 ,size(s,2));
BoxCenElmts=zeros(1 ,size(s,2));
% Center Frequency
% Bandwidth
% frequency
% Center Frequency
% x point or start of box
% width of box in frequ
% center of box in time
% width of box in time
% the elements at box center
mor=zeros(1 ,size(et,2));
allMor=zeros(1 ,size(et,2));
zeta =0;
sigmaw=0;
y=o;
h=0;
% Morlet
% Morlet for each column of data in dataFile
% CenterFreq
% Bandwidth
%'
Initialize other vanables
LstBoxEndPnt=0;
rowCnlr = 1;
colCntr= 1;
n=1;
b1=0;
Wo=5;
Bo=1.701;
% Last Box End point
% Count number of rows
% Count number of columns
% init n. a counter
% initial offset
% initial frequency
% initial bandwidth
For Boxes Only: Calculate the Morlet Wavelet
fork=1:size(s,2)
ws(k)=Wo/s(k);
Bs(k)=Bo/(s(k));
f(k)=(ws(k)/pi);
% iterate though the number of columns in the dataFile.m
% find initial value of center frequency for each row of the dataFile.m, base on s(k)
% find Initial value of bandwidth for each row of the dataFile.m. base on s(k)
% find the frequency value (only used for T(k)
49
T(k)=1/f(k);
% a temporary value of time.
zeta =( (ws(k))/pi): % CenterFreq
sigmaw=(Bs(k)/pi); % Bandwidth
q1 (k)=(T(k)b1 )/s(k); % for the Morlet wavelet
p1 (k)=((q1 (k)A2)/2); % for the Morlet wavelet
% calculate the Morlet wavelet
mor1(k)=(1\sqrt(s(k)))*(exp(pl(k))).*cos(5.*q1(k));
sigmat=abs(mor1 (k)*s(k)); % TimeWidth
u=( T(k)+(sigmat/2)); % TimeCenter
create Boxes
% Find the start and end point of boxes
x=(u{sigmat/2))*(s(k)); % the start point of the first box in time
y=( (zeta(sigmaw/(2)))); % the start point of the first box in frequency
w=abs(sigmat)*(s(kj); % the width of the first box in time
h=(abs(sigmaw)); % the width of the first box in frequency
% plot rows and columns of input dataFile as Boxes
if (coICntr == k)
Column=dataFile(:,colCntr); % Column is a vector exactly equal to the column(k). This increases the column number
v = u*(s(k));
while (rowCntr<= dataSize(1))
Elmt=Column(n);
x=(v(w/2));
xA(rowCntr,colCntr)=x;
wA(rowCntr,colCntr)=w;
cxA(rowCntr,colCntr)=x+(w/2);
trans=wA(rowCntr,colCntr)+1.5;
% set the Time Center, equal to a new variable. V
% Elmt is the value of each element in the column.
% find x based on v.
% Store all x's in an array the same size as the dataFile array
% Store all ws in an array the same size as the dataFile array
% Store all center of boxes in an array the same size as the dataFile array
% Control separation between boxes.
% Plot Center Frequencies of Boxes
if ((w+x) < max(max(et))) % if the box is in the time range
rect=(rectangle('Position, [xyw h])); % figure out a rectangle
semilogy(rect*.02); xlabel(Time'); ytabel('Frequency'); grid on; hold on; %plot the rectangle on a log scale
if (Elmt == 0)
plot(v,zeta,bo'): % if the element in the data array is a 'O' plot a o'
else
plot(v,zeta,'b*'): % else, plot a '
end
end
v = v + trans;
oldMor = mor,
oldet = et;
n=n+1;
rowCntr=rowCntr+1;
end %end while rowCnir <= dataSize(i)
coICntr = coICntr+1;
rowCntr=1;
n=1;
end % end if (coICntr == k)
end % end for k=1 :size(s,2)
50
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
% 'deccde.m'
%
% Finds the original binary data from unnoisy or from noisy wavelet.
% For every column of data in the data file, the function counts until the
% end of the channel's time period and it counts until the end of the last
% box's center point. The cwt function imports the summed total of wavelet
% functions in the channel, including any noise added to the signal finds
% the coefficients of the continuous wavelet transform array.
% The coefficient energy values returned are very small values if the
% discrete data matrix has a zero value, or they are very large values if
% the matrix has a value of one. The dependency threshold of the large and
% small value magnitude can be adjusted.
%
%
%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
load temp2.m:
thresh=temp2;
The Data is Decoding
^ 0QCQd6 ****************************
mCntr=1; %setupa
counter, m.
for rowCntr =1:1 :dataSize(2) %for every column, do the
following.
qCntr=1; %set up another
counter q.
while (qCntr <= size(et,2)) & (mCntr <= size(cxA,1)) %while (q <= max Time) & (m <= row Size of cxA)
%if diff b/w some point in time and value of Box center <001 & value of Box center >.0001
if ((et(qCntr)cxA(mCntr,rowCntr))<.0015) & ((et(qCntr)cxA(mCntr,rowCntr))> .0001)
%put elemnt of BoxCenlr in an array called BoxCenElmts
BoxCenElmts(mCntr,rowCntr)=qCntr,
% Find the coeffients of the wavelet transform 'total'
coeffs(mCntr.rowCntr)=cwt(total(1, qCntr), s(rbwCntr),'morl');
if (coeffs(mCntr,rowCntr) >= thresh)
Decoded_Data(mCntr,rowCntr)=1;
else
Decoded_Data(mCntr.rowCntr)=0;
end
mCntr=mCntr+1;
end
qCntr=qCntr+1;
end
mCntr=1;
end
%Decoded_Data
'Push "Output File" to see the decoded data'
51
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%
%%%%%%%%%%%
%
%
% 'svcbacm'
% This function is for the encode data slider values
%
%
%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%
function svcbackQ
% function call
Hc_az=findobj(gcf,Tag'I'AZslider');%
Hc_cur=findobj(gcfITag,,,AZcur,);
str=num2str(get(Hc_az,,Value,)):
num=get(Hc_az, Value'):
set(Hc_cur, 'String',str);
define a slider abject
% put the current value of the slider obj in Hc_cur.
% convert the number to a string
% put the value of the slider into 'num'
% writes the value to the text box
fid = fopen('temp1.m7w');
COUNT = fprintf(fid,'%3.3f\n.num);
fclose(fid);
% open the tempi .m file
% write the value of the slider in the file
% close the file.
52
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%
%
%
% 'svcbac2.m'
% This function is for the Threshold data slider values
%
%
%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%
function svcback2()
% function call
Hc_az=findobj(gcf,Tag7BZslider');% define e slider object
Hc_cur=findobj(gcf,Tag','BZcur');
str=num2str(get(Hc_a2, Value'));
num=get(Hc_az, Value');
set(Hc_cur, 'String'.str);
% put the current value of the slider obj in Hc_cur.
% convert the number to a string
% put the value of the slider into 'num'
% writes the value to the text box
fid = fopenftemp2.m','w');
COUNT = fprintf(fid.'%3.3f\n',num);
fclose(fid);
% open the tempi.m file
% write the value of the slider in the file
% close the file.
53
function fig = wguiQ
% This is the machinegenerated representation of a Handle Graphics object
% and its children. Note that handle values may change when these objects
% are recreated. This may cause problems with any callbacks written to
% depend on the value of the handle at the time the object was saved.
% This problem is solved by saving the cutout as a FIGfile.
%
% To reopen this object, just type the name of the Mfile at the MATLAB
% prompt The Mfile and its associated MATfile must be on your path.
%
% NOTE: certain newer features in MATLAB may not have been saved in this
% Mfile due to limitations of this format, which has been superseded by
% FIGfiles. Figures which have been annotated using the plot editor tools
% are incompatible with the Mfile/MATfile format, and should be saved as
% FIGfiles.
load wgui
hO = figure('Co!or',[0.8 0.8 0.8],...
'Colormap'.matO,...
'FileName','C:\MATLABR11\work\wgui.m',...
'PaperPosition',[18 180 576 432],...
'Paperllnits','points', ...
'Position',[447 123 550 420],...
Tag'.'Figr,...
'ToolBarVnone');
hi = uicontrolfParent'.hO, ...
'Units'.'points',...
BackgroundColor\[0.78B235294117647 0.788235294117647 0.788235294117647],
'FontWeight'.'bold',...
'ListboxTop',0,...
Position,[6.75 288 48.75 23.25],...
'String','Input Parameters',...
'Style','text',...
Tag'.'StaticTextl');
hi = uicontrolfParent'.hO,...
'Units'.'points',...
'BackgroundColor1,[0.788235294117647 0.788235294117647 0.788235294117647],
'FontWeight'.'bold',...
'ListboxTop',0,...
'Position',[6.75 215.25 48.75 23.25],...
String,'Encode Data',...
'Style'.'text',...
Tag'.'StaticTextl');
hi = uicontrolfParent'.hO, ...
'Units'.'points',...
BackgroundColor1,[0.788235294117647 0.788235294117647 0.788235294117647],
'FontWeight'.'bold',...
'ListboxTop',0,...
'Position'.[6.75 84 48.75 23.25],...
'String','Decode Data',...
'Style'.'text',...
Tag'.'StaticTextl'):
hi = uicontrolfParent'.hO,...
'Units.'points',...
'BackgroundColor',[0.847058823529412 0.815686274509804 0.784313725490196],
'Caliback'.matl,...
ListboxTop',0....
'Position',[8.625 251.25 45 15],...
'String','Graph Data',...
Tag.Pushbuttonl',...
TooltipString,'Represent 1s & Os as Boxes');
hi = uicontrolfParent'.hO,...
'Units'.'points',...
'BackgroundColor1, [0.847058823529412 0.815686274509804 0.784313725490196],
54
'CallbacK'.'open dataFile.m',...
'ListboxTop',0,...
'Position',[8.625 269.25 45 15], ...
'String','Data File',...
Tag,'Pushbutton2',...
TooltipString',View, Modify the input data.');
hi = uicontrol('Parent',hO,...
'Units','points',...
BackgroundColOri,[0.847058823529412 0.815686274509804 0.784313725490196],...
'Callback','analog',...
'ListboxTop',0,...
'PositiOn',[8.625 165 45 15],...
'String'/Plot Morlef,...
Tag','Pushbutton3,...
TooltipString','Plot the Encoded Data. Noise is added to the data.');
hi = uicontrolf Parent,hO....
'Units','points',...
'BackgroundColor',[0.847058823529412 0.815686274509804 0.784313725490196],...
'Callback','decode1....
'ListboxTop',0,...
'Position',[8.625 30.75 4515],...
'String','Decode',...
Tag','Pushbutton4',...
TooltipString'.'Retum the Encoded data, along with any noise, to the origional binary data.');
hi = uicontrol('Parenf,hO,...
'Units',points',...
'BackgroundColor',[0.847058823529412 0.815686274509804 0.784313725490196],...
'Callback1 ,'Pdecode',...
'ListboxTop',0,...
'Position',[8.625 11.2545 15],...
'String','Ouput Data',...
Tag'.'PushbuttonS);
hi = uicontrol('Parent',hO,...
'Units','points', ...
'BackgroundColor',[0.847058823529412 0.815686274509804 0.784313725490196],...
'ListboxTop',0,...
'Position',[0 242.25 63 0.75],...
'Style','frame',...
Tag','Frame2');
hi = axesfParent'.hO, ...
'Units,'pixels',...
'Box,'on',...
'CameraUpVector,[0 1 0],...
'CameraUpVectorMode'.manuar,...
'Color',[1 1 1],...
ColorOrder,mat2, ...
'NextPlot'.'add',...
'Position',[141 37 398 257],...
Tag','Axes2',...
'XColor',[0 0 0],...
'XGrid'.'on',...
'XTickLaber.ro ';'0.2';'0.4';'0.6;'0.8';'1 %...
'XTickLabelMode','manual',...
TColor',[0 0 0],...
'YGrid'.'on',...
'YScale'.'log',...
ZColor',[0 0 0],...
'ZGrid'.on');
h2 = textfParent',hi,...
'Color'.fO 0 0],...
'HandleVisibilityVoff,...
'HorizontalAlignment',center",...
'Position',[0.4987405541561713 0.08058421877614819 9.160254037844386],...
'Tag','Axes2Text4',...
VerticalAlignmentVcap');
set(get(h2,'Parent'),'XLabel',h2);
55
h2= textfParenf.hl,...
'Color,[0 0 0],...
HandleVisibility'.'ofr, ...
'HorizontalAlignmenf.'center,...
'Position',[0.08312342569269521 0.3133962171418216 9.160254037844386],...
'Rotation',90....
Tag','Axes2Text3',...
VerticalAlignment','baseline');
set(get(h2,'Parenf),'YLaber,h2);
h2 = textfParenf.hl,...
'Color1,[0 0 0],...
'HandleVisibility'.'ofr. ...
'HorizontalAlignmenf,'right',...
Position',[0.3551637279596977 3.105900223624705 9.160254037844386],...
Tag','Axes2Text2,...
Visible'.'off);
set(get(h2,'Parenf),'ZLabel',h2);
h2 = textfParenf.hl,...
'Color',[0 0 0],...
'HandleVisibility'.'ofr,...
'HorizontalAlignmenf.'center', ...
Position',[0.4987405541561713 1.064985635350429 9.160254037844386],...
Tag','Axes2Textr,...
VerticalAlignment','bottom');
set(get(h2,'Parent'),Title,h2);
hi = uicontrolfParent'.hO,...
'Units'.'points',...
'ListboxTop',0,...
Position',[0.75108.75 63 0.75],...
'Style','frame',...
Tag','Frame2');
hi = uicontrolfParent'.hO,...
'BackgroundColor,[0.847058823529412 0.815686274509804 0.784313725490196],
Callback, svcback,...
'ListboxTop',0,...
Max',0.5....
'Position',[20.5 263 44 20],...
'StyleVsIider1,...
Tag.'AZsIider1,...
Tooltipstring','Add noise to the Encoded Data');
hi = uicontrolfParenf.hO,...
'BackgroundColori,[0.788235294117647 0.7BB235294117647 0.788235294117647],
'ListboxTop',0,...
'Position',[5 265 14 15],...
'String','0'....
'Style'.texf,...
Tag',StaticText3');
hi = uicontrolfParenf.hO,...
'BackgroundColof,[0.788235294117647 0.788235294117647 0.788235294117647],
'ListboxTop',0,...
'Position',[65 261 18 20],...
'String','0.5',...
'Style','text',...
Tag,'StaticText2);
hi = uicontrolfParent'.hO,...
'BackgroundColor,[0.788235294117647 0.788235294117647 0.788235294117647],
'ListboxTop',0,...
'Position',[38 244 43 16],...
'String','O',...
'Style','texf,...
TagVAZcur);
hi = uicontrolfParenf.hO,...
'Units'.'points',...
'BackgroundColor,[0.788235294117647 0.788235294117647 0.788235294117647],
'LislboxTop',0,...
'Position',[1.5 182.25 21 12.75],...
56
'String','Noise:',...
'Style','text1,...
Tag,'StaticText4');
hi = uicontrolfParenf.hO,...
'Units','points',...
'BackgroundColor'.[0.788235294117647 0.788235294117647 0.788235294117647],.
'ListboxTop',0,...
'Position',[0.75 53.25 30.75 10.5],...
'String'.'Thresh:', ...
'Style'.'texf,...
Tag',StaticText4');
hi = uicontrolfParenf.hO,...
'BackgroundColor',[0.788235294117647 0.788235294117647 0.788235294117647],.
'ListboxToo,0,...
'Position',[40 69 41 16],...
. 'String','O',...
'Style','text1,...
Tag'.'BZcur1);
hi = uicontrol('Parent',hO,...
BackgroundColor\[0.788235294117647 0.788235294117647 0.788235294117647],.
'ListboxTop',0,...
'Position',[64 87 18 20],...
'String','0.5',...
'Style','text',...
'Tag','StaticText2'):
hi = uicontrol('Parent',hO, ...
'8ackgroundColor\[0.788235294117647 0.788235294117647 0.788235294117647],.
'ListboxTop',0,...
'Position',[5 91 14 15],...
'String'.'O',...
'Style','text1,...
Tag','StaticText3');
hi = uicontrol('Parent',hO,...
'BackgroundColor",[0.847058823529412 0.815686274509804 0.784313725490196],.
'Callback','svcback2'....
'ListboxTop',0,...
'Max',0.5,...
'Position',[20.5 91 44 20],...
'Style','slidef,...
Tag','BZs!ider\...
TooltipString'.'Smaller values give tighter thresholds');
hi = uicontrolfParenf.hO,...
'Units,'points',...
'ListboxTop,0,...
'Position',[0 158.25 63 0.75],...
'Style','frame', ...
Tag','Frame2');
hi = uicontrolfParenf.hO,...
'Units','points',...
'BackgroundColor1,[0.788235294117647 0.788235294117647 0.788235294117647],.
'FontWeighf.bold',...
'ListboxTop',0,...
'Position',[6.75133.5 48.75 23.25],...
'String'.'Energy Intensity',...
'Style'.'texf....
TagVStaticTextV);
hi = uicontrolfParenf.hO,...
'Units','points',...
'B.ackgroundColof,[0.847058823529412 0.815686274509804 0.784313725490196],.
'Callback','analog',...
'ListboxTop',0,...
'Position',[5.25 115.5 51.75 15],...
'String','Plot', ...
'Tag','Pushbutton3',...
TooltipString'.'Plot the Encoded Data. Noise is added to the data.');
hi = uicontrolfParenf.hO,...
57
'Units','points',...
'ListboxTop',0,...
'Position',[62.25 0.75 0.75 312],...
'Style','frame',...
Tag'.'Framel');
hi = axes('Parent',hO,...
'Units','pixels',...
'CameraUpVector',[0 1 0],...
'CameraUpVectorMode','manual',...
'Color',[1 1 1],...
'ColorOrdeT,mat3,...
'Position',[141 318 395 97],...
Tag','Axes1',...
'XColor\[0 0 0],...
'XGrid.'on', ...
'XLimMode'.'manuaT,...
xnck',[0 0.2 0.4 0.6 0.8 1], ...
'XTickLabelMode'.'manual',...
'XTickMode'.'manual',...
'YColor\[0 0 0],...
"YGrid'.'on',...
'ZColor'.IO 0 0],...
'ZGrid'.'on');
h2 = text(Parent',h1,...
'Color',[0 0 0],...
'HandleVisibilityVofT,...
'HorizontalAlignment','center1,...
'Position',mat4,...
Tag','Axes1Text4',...
VerticalAlignment','cap');
set(get(h2,'Parent'),XLabeT,h2);
h2 = textCParenf.hl,...
'Color1,[0 0 0],...
'HandleVisibilityVofT,...
'HorizontaiAlignmenT,'center1,...
Position',[0.07360406091370556 0.4895833333333333 9.160254037844386],...
'Rotation',90,...
'Tag','Axes1Text3',...
VerticalAlignmentVbaseline);
set(get(h2,'Parent'),'YLaber,h2);
h2 = text('Parent',h1,...
'Color',[0 0 0],...
'HandleVisibilityVofT,...
'HorizontalAlignment','right',...
Position',[0.3578680203045685 1.052083333333333 9.160254037844386],...
Tag','Axes1Text2',...
Visible','off);
set(get(h2,'Parent'),'ZLaber,h2);
h2 = text('Parent',h1,...
'Color1,[0 0 0],...
'HandleVsibility'.'off,...
'HorizontalAlignment'.'centeT,...
'Position',mats,...
Tag,Axes1Text1',...
VerticalAlignment','bottom');
set(get(h2.Parent'),Title',h2);
if nargout > 0, fig = hO; end
58
BIBLIOGRAPHY
[1] Teolis, Anthony, 1998, Computational Signal Processing with Wavelets, 1st ed.
Boston, MA: Birkhauser.
[2] Amara Graps, 1997 An Introduction to Wavelets a Historical Perspective, World
Wide Web, MaxPlanckInstitut fur Kemphysik, Saupfercheckweg, Heidelberg,
Germany.
[3] Mallat, Stephane, 1999, A Wavelet Tour of Signal Processing, 2Tld ed. San Diego,
CA: Academic Press.
[4] Pierre Goupillaud, 2002, Biographies \ Jean P. Morlet,
http://www.seg.org/museuin/VM/biojean_p__morlet.html
59

PAGE 1
EFFIOENT, SECURE AND NOISE ROBUST DATA ENCODING AND DECODING WAVELETBASED ALGORITInv.I by Joseph B. Klingman B.S., The New Mexico Institute of Mining and Technology, 1996 A thesis submitted to the University of Colorado at Denver in partial fulfillment of the requirements for the degree of Master of Science Electrical Engineering 2002
PAGE 2
Tills thesis for the Master of Science degree by Joseph B. Klingman has been approved by Jan Bialasiewicz 7 .Date
PAGE 3
Klingman, Joseph B. (M.S. Electrical Engineering) Efficient, Secure and Noise Robust Data Encoding and Decoding WaveletBased Algorithm. Thesis directed by Associate Professor Jan Bialasiewicz. ABSTRACT Wavelet transforms are essential components of signal processing and provide mathematical tools for the analysis of timevariant, spacevariant signals. Naturally occurring signals are good candidates for such analysis. Although mathematical tools, such as the Fourier transform, are excellent for signal analysis and decomposition, Wavelet transforms provide utilities for the decomposition of signals over time and frequency. A fundamental problem in digital communication is accurate and secure transfer of the signal from one location to another. The data must be transformed into an analog signal, transmitted and received. It is intended to transfer a signal with the possibility of interception by outside entities, while allowing the receiver to decode it accurately. Before, during or after the signal is transmitted, the addition of noise must be considered. The decoding of data requires the removal of all noise, and it requires decoding ofthe encoded data, leaving the original discrete data. This process allows for the transformation of the analog signal into digital data with a low bit error rate. These objectives are achieved in an algorithm developed here in, and is used lil
PAGE 4
as the basis for a graphical user interface, which encodes digital data, transmits the data, and decodes the data leaving the original digital data. Tills abstract accurately represents the content of the candidate's thesis. I recommend publication. IV
PAGE 5
DEDICATION This thesis is dedicated to my wife, Colleen, and to my daughter, Alexandria, who endured incessant hours of study and provided limitless support and understanding.
PAGE 6
ACKNOWLEDGMENT The author wishes to express sincere appreciation to Dr. Jan Bialasiewicz for his invaluable guidance and unfaltering patience during the study phase of this material and for his assistance in the preparation of this thesis.
PAGE 7
CONTENTS Figures ................................................................................................................ ix Tables ................................................................................................................. xi Chapter 1. Introduction ............................................................................................................... 1.1 Summary ..................................................................................................... 1 1.2 ....................................................................................................... 3 1.3 Goals and Solutions ............... : ..................................................................... 3 1.4 Organization and Features .......................................................................... 4 2. Background ................................................................................................................ 6 2.1 Wavelet TimeFrequency Signal Processing ............................................. 8 2.2 Wavelet Equations .................................................... .................................. 9 2.3 The Morlet Wavelet .................................................................................. 12 3. Algorithm ImpleiDentation ................................................................................... 14 3.1 The Get Data Utility .................................................................................. 15 3.2 Calculate Morlet Wavelet Utility .............................................................. 16 3.3 Encode Data Utility ................................................................................... 20 3.4 Add Noise Utility ....................................................................... ............ 22 3.5 The Decode Data Function ....................................................................... 25 3.6 Signal to Noise Ratio ................................................................................ 29 4. Operations ................................................................................................................ 31 4.1 Graphical User Interface ........................................................................... 31 4.1.1 Input Parameters ..................................................................................... 32 4.1.2 Encode Data ........................................................................................... 34 4.1.3 Energy Detection & Noise Rejection .................................................... 37 4.1.4 BitRecovery ........................................................................................... 38 5. Conclusion ............................................................................................................... 43 Appendix A. Matlab Computer Programs ........ ................................................................ 45 V1l
PAGE 8
Bibliography ...................................................................................................... 59 V1ll
PAGE 9
FIGURES Figure 1.11 A Morlet Wavelet ................................................................................... 2 2.21 TimeFrequency Representation of Energy [3] ................................... 12 31 Algorithm Flow Diagram ..................................................................... 14 3.21 The Morlet Wavelet Utility .................................................................. 17 3.22 Create and Plot Boxes Utility ............................................................... 18 3.23 Rectangles Representing Energy .......................................................... 19 3.31 Create Basic Wavelet Utility ................................................................ 21 3.32 The Encode Data Utility ....................................................................... 21 3.33 Encoded Data ........................................................................................ 22 3.41 Noise' Slider Graphical User Interface ................................................ 23 3.42 The 'svcback' Function .......................................................................... 24 3.43 The 'Add Noise' Utility ......................................................................... 24 3.44 Encoded Data ............................................................................. 25 3.51 The Decode Utility ................................................................................ 28 4.11 The Graphical User lntetface ............................................................... 31 4.1.11 Discrete Data Representation ............................................................... 33 4.1.21 Encoded Discrete Data ......................................................................... 36 1X
PAGE 10
4.1.22 Noise Added to Encoded Data ............................................................. 36 4.1.41 Encoded Data with Reduced Noise ..................................................... .40 4.1.42 Increased Noise Level ................................................ : ......................... 41 X
PAGE 11
TABLES Table 3.11 Binary Matrix Data File ........................................................................ 16 4.1.41 Decoded Data ........................................................................................ 41 4.1.42 Decoded Data Degradation ........ : ......................................................... .42 xi
PAGE 12
1. Introduction 1.1 Summacy Many applications require analog signals be transmitted and received, where an analog signal is a continuous waveform generated either by natural means or generated synthetically. Analog signals are produced from such sources as speech, music and video signals. The signal carries information which, by utilizing signal processing methods, can be extracted and utilized. The method of information extraction depends on the type of signal and the nature of the information carried by the signal. Signal processing is concerned with mathematical representations of the signal and algorithmic operations used to extract information from the signal. In some cases representing the signal in a transformed domain benefits signal processing. In the case of discrete time signals, it may be easier to extract data from a signal in the frequency domain rather than the time domain. When the signal is represented as stationary in time, ideal mathematical tools to transform the signal, such as the Fourier transform, are available. Many signals are dynamic over time and can be represented as such by transforming, or decomposing, the signal into smaller parts. These parts are lmown as atoms and allow us to analyze simpler parts of the signal which, in whole, make up the entire signal. The atoms can be represented on the timefrequency plane, and can be scaled to represent changes in energy along the signal. Utilizing the wavelet method, localization of the signal can be accomplished very efficiently and the wavelets represent discontinuities very well. 1
PAGE 13
Digital data can be transformed into the continuous domain using wavelet transforms. A wavelet, representing a single bit of data, stretches, contracts and translates over time, depending its scale. Figure 1.11 illustrates a single decomposition of a signal using wavelet methods. Wavelets transform one dimensional data into two dimensions, time and frequency. Wavelets decompose each part of the discrete signal into small sections of energy. This energy signal is represented as a continuous waveform, whose magnitude represents the frequency of the signal. Figure 1.11 AMorlet Wavelet I I I I I I I 0.5 1 I I 1 I I n4 I I I I I 03 1 I I I I i.0.2 1 I l)' 0.1 1: 1 I I I I I Q) ::I C" S:! .1 I I I I I I u.. I I I I I .. Q.3 ... .. I I I I I I I I 1 I I I I I 1 I I I I I I 1 I I I I I I 10 15 31. 35 Tlllle 4l 45 Contraction and dilation of the Wavelet is accomplished by changing the values of Scale (s). For s > 1, larger values contract the wavelet in time and dilate the wavelet in frequency. Wavelet signals are recovered utilizing knowledge ofthe wavelet transforms. That is, the Continuous Wavelet Transform (cwt) is invertible. 2
PAGE 14
t2 Problem Efficient transmission of a digital signal without interception by outside parties is a condensed summary of the problem. This secure transmission is accomplished with satisfactory throughput and low bit error upon decoding. This accomplishment takes into consideration multiple users per channel. The timefrequency domain depicted in Figure 1.11 can be thought of as a channel, where multiple users, each utilizing a different frequency, transmit bits of information. Users have the flexibility to transmit data at different times, and the channel is made of many bits of data along the timeline. The wavelet approach parses the timefrequency region into smaller atomic parts. L3 Goals and Solutions Parsing the timefrequency region into smaller atomic parts allows for the application of wavelets to these individual parts with lower probability of error, lower bit error rates, higher throughput, and higher security. The solution involves encoding digital data into an analog signal, adding noise to the signal, sending the signal to the receiver, and decoding the signal back into the original discrete data. This paper demonstrates a computerbased algorithm which provides a solution for these goals. The algorithm shows multiple users accessing the channel, it shows the encoded data, and it shows the decoded data with a minimum bit error rate. There are two main areas of development. The first is the Encoding of data for every user who accesses the channel and the adding of noise to more accurately represent transmission, and the second is the recovery of the transmitted information with a low bit error rate. Encoding is accomplished by decomposing the data into atoms, analyzing the data, then rebuilding the data. The atoms are represented on the 3
PAGE 15
channel, in time and frequency, and the channel allows for the representation of bandwidth for each user. Using wavelet transforms, this data is represented in the time domain as continuous waveform. After the discrete data is decomposed on the channel, each part is then transformed into a wavelet and summed to represent an analog signal. Decoding occurs after the analog signal has been transmitted. Intended or not, transmitting the signal always includes the addition of noise to the signal. If the addition of noise is not intended, computer hardware, wires and transmitting devices naturally add noise to the signal. From the point the signal leaves the transmitter to the point of receipt, the signal, in all probability, will pick up noise. Often times it is necessary to add noise to the system. Examples include communications involving military, business and Internet applications, requiring secure transmission. Regardless of the noise level, in order to receive an accurately transmitted signal, this algorithm requires that the signal be decoded. If the discrete data is encoded with a wavelet, it follows that the encoded signal can be decoded and digitized utilizing wavelet transforms. The wavelet computes the continuous wavelet coefficients, and these coefficients are compared to threshold values and used to determine the original discrete data. If the locations of the original atoms are known within the timefrequency channel, then the coefficients can be used to correlate the transmitted signal with discrete data and a new, but equivalent, discrete data file can be built. 1.4 Organization and Features Wha:t follows is a presentation of the Efficient, Secure and Noise Robust Data Encoding And Decoding WaveletBased Algorithm. A short background and history of the wavelet introduces the concepts. In order to completely explain wavelets, a general understanding of the wavelet equations is shown. Several types 4
PAGE 16
of wavelet transforms are in existence, however, for use in the Efficient, Secure and Noise Robust Data Encoding And Decoding WaveletBased Algorithm, the Morlet wavelet is introduced. The algorithm is written in the Matlab technical computing language. The third section describes encoding and decoding algorithms in detail. Each section of the Matlab programming language is shown along with detailed explanations for each section. This demonstrates how the discrete data file is retrieved, how the Morlet wavelet is calculated, how the data is encoded and finally how it is decoded. The Operations section shows how the graphical user interface is used and how the algorithm is implemented. This section demonstrates the algorithm's ability to decode data at a low bit error rate, how the user can control the bit error rate, and it demonstrates where the algorithm begins to fail when an excessive amount of noise is added to the transmitted signal. 5
PAGE 17
2. Background Wavelets first appeared in 1909 and, to a great extent, much of the work in Wavelets was accomplished in the 1930s. However, in the early 1800's, one of the most significant contributions leading to wavelet theory was Joseph Fourier and his theories of Fourier synthesis developed in 1807[2]. His theories opened new ideas for mathematics and functions. He showed that any periodic function/ (x), with 27t period multiples, is equal to the sum: where 1 2.nao =jJ(x)dx 2tr 0 1 2n ak =fJ(x)cos(kx)dx, "o 1 2n bk =fJ(x)sin(kx)dx, 1! 0 (2.1) (2.2) (2.3) (2.4) After this theory was introduced, mathematicians were inspired to begin researching functions and their meaning; they explored Fourier series in depth; and they developed new concepts. Eventually, the studies of this frequency analysis lead to a new idea, that is, the idea of scale analysis. The idea is to create mathematical functions and shift them in time, for example, and change their scale. Scale is 6
PAGE 18
analogous to magnitude. However, if the function's scale of frequency changes, so will its time period, leaving the overall energy of the signal unchanged. One benefit of scale analysis is that, if it is repeated many times, it allows for the summation and average of the function at many different scales. If the function turns out to be a communications signal, it would be less sensitive to noise because average changes in the signal are measured at different scales. This idea was the basis for wavelets and first emerged in A. Haar's thesis in 1909. Haar's wavelets are not continuously differentiable which somewhat limits their applications [2]. In the 1930s, mathematicians and scientists began to research the application of varying scale to functions. The Haar wavelet was applied to such functions as random signals and energy functions. Between 1960 and 1980, Weiss and Coifman applied wavelets to the most basic elements of functions, called atoms. Their goal was to be able to reconstruct the many atoms of a function. In 1980, Grossman and Morlet, a physicist and an engineer, paved a new way of thinking about wavelets based on physical intuition, by defining wavelets in the context of quantum physics. Today, Stephane Mallat, author ofthe text A Wavelet Tour of Signal Processing, applies wavelets to digital signal processing and Meyer constructed the first continuously differentiable wavelets. Most recently, Ingrid Daubechies constructed a set of wavelet orthonormal basis functions, based on Mallat's work, and some say may be the most elegant of wavelet applications today. After several years of field work Morlet in 1972 devoted all his efforts to enhancing the resolution of seismic events while processing field data. By the mid'70s, he developed a technique he called "cycleoctave transform," which is now the 7
PAGE 19
universally accepted "wavelet transform." Following in the footsteps of Denis Gabor, Morlet was pui:zled by the poor results he obtained but was persistent. Morlet kept the constraint resulting from the uncertainty principle applied to time and frequency, but he perceived that it was the wave shape that must be invariant to give uniform resolution in the entire plane. By 1975, he adapted the sampling rate to the frequency, thereby creating, in effect, a changing time scale producing a stretching of the wave shape. Today the wavelet transform is also called the "time scale analysis" approach, which is comparable to the conventional timefrequency analysis [4]. 2.1 Wavelet TimeFrequency Signal Processing Many real world signals are analog in nature, and in order to apply analog signals to computers, they need to be converted to discrete data. The encoding and decoding waveletbased algorithm presented in this thesis begins with digital data; it encodes the signal by converting the data to analog. Encoding is the process of constructing signal from the user data, or bits, and transforms the data into a signal unlike the original data and unknown to any unwanted recipients of the signal. Noise may also be added to the signal, either synthetically before transmission or naturally during transmission. The algorithm decodes the data by applying wavelets to convert the analog signal back into a digital signal by removing noise from the received signal. Decoding is the process of recovering the original user data from the transmitted signal. The algorithm begins to take on yet more useful applications when multiple users of a certain chanilel are taken into consideration. The channel is based on a range of 8
PAGE 20
frequencies, and at certain frequencies, a digital signal is fed through the channel. This process is termed multiple access. Users transmit(bk) bits, where k=1,2,3 ... N, and N is the number of users. This translates to the total number of bits through the channel as (bk):=1 (3). If the channel is thought of as a timefrequency region, the region can be broken up into smaller parts, where there is a lower error rate, a higher level of security, and a higher throughput rate. These smaller parts of the waveform are defined by small bursts of energy over a partitioned time period. Thus, the term wavelet applies to this definition. 2.2 Wavelet Equations A wavelet begins with the summation of many parts of the signal. If the wavelet is represented as 'f/, then the wavelet can be summed using: .. J'lj/(t)dt (2.5) When scale (s) is applied to this function, the wavelet can be dilated or contracted along the timefrequency channel. If the wavelet is dilated in time, it is subsequently contracted in frequency. Likewise, if the wavelet is contracted in time, it is subsequently dilated in frequency. The function, or wavelet, can also be translated by (u). This translation is a time shift, and as a result, the wavelet can its magnitude in time and frequency, at any point in time within the channel. If (t) represents time, then the basic wavelet becomes: 1 (tu) 'If/ ='lj/r .J; s (2.6) 9
PAGE 21
If we let vrrbe a defining wavelet called a basic wavelet, wavelet atoms can be defmed by how much each atom is dilated and translated. The center of the probability distribution, lr (!)12 is given by .., ur = Jtlr (t)l2 dt Second, the variance [3] around uyis given by ., u,2(r)= J(tur>2lr(t)l2 dt (2.7) (2.8) This gives an indication of how probable it is that energy is focused near the center point of the wavelet. The center is therefore defined by 1 U) A 2 qr =fmlr(m)l dm, and the wavelet's spread [3] around the center frequency is 27i(2.9) At any point in time, the following function can be applied to the signalf(t): "'J 1 (tu) Wf(u,s) = _..,f(t) ..[i If/ sdt (2.10) 10
PAGE 22
lbis can be written as a convolution: Wf(u,s) = f*llfs(u), (2.11) where 1 (tu) 1/f sC u) = ..Js If/ s(2.12) Wf(u,s) gives the variation of/in the region of (u). The value of W(u,s) depends on the location of energy of 1/fu,s In time, 1/fu,s is centered at (u, nls) with a dilation proportional to the scale (s). This energy is represented as a rectangle, shown in figure 2.21. In this figure, the concentration of energy on the (t, aJ) axis changes with the rectangle position and scale, while the magnitude of energy remains the same. cr00 represents the frequency interval size, and O"t represents the time interval size. The wavelet's energy is concentrated in a frequency interval, defined by the rectangle, whose size is scaled by sin the time axis and 1/s in the frequency axis. When s varies, the height and width of the rectangle change size, but its area remains constant. For each atom, centered at (u, the timefrequency plane, the energy distribution of (f) is given by: CD 2 PT = jJ(t)tj/ (u,;) (t)dt 11 (2.13)
PAGE 23
Figure 2.21 TimeFrequency Representation of Energy [3] ro cro/s1 n/s tF:0 t u 2.3 The Morlet Wavelet Although there are several different types of wavelets, the encoding and decoding waveletbased algorithm utilizes the Morlet wavelet. This wavelet is useful for specifying wavelets in the timefrequency domain, using the parameters of center frequency and bandwidth, ( crm). There are two more advantages of the Morlet wavelet; it supports the entire frequency axis, rather than only intervals, and it is a modulated Gaussian function. The form of the Morlet wavelet is: (2.14) 12
PAGE 24
where 'I' max is the maximum value, and u(J) = Jm2,V(m)dm. The Morlet Wavelet contains exponential decay in both time and frequency, which makes it optimal for the encoding and decoding waveletbased algorithm. The Morlet function is represented in equation 2.16 below. 'l'r = _1_'1'(! u) = _1_e((tu)ts)2t2 cos(m(t u)l s) (2.15) J; s J; This equation is exponential in time, t, translated by u, with frequency m and scale (s). 13
PAGE 25
3. Algorithm Implementation There are eight parts to the Data Encoding and Decoding Wavelet Based Algorithm. Figure 3.1 demonstrates the algorithm flow. The algorithm begins with an ASCIT text data file and is a matrix of binary data; each column in the matrix represents data at a particular center frequency, and the number of rows determines the number of rectangles for each center frequency. An MxN matrix is represented as N center frequencies, each containing M rectangles. Each 'one' in the matrix indicates a command to the algorithm and the algorithm calculates a wavelet. A 'zero' indicates that no frequency is passed to the algorithm, or added to the encoded signal. Figure 3.1 shows the high level nature ofthe algorithm flow diagram. Figwe 3.1 Algorithm Flow Diagram Binay Mattix Ftnd lhc: Sial! and Cld 0110 poinJs for evcy 1m 101 ... Plat..,.... and a>lurms ofinpul da!a FBK!Iho center ElcmcniS of '.__...: as Boxes evcyi>Jx Plor Center ofi>Jxcs D=do lho dala l find the samo ei......,IS in lho docoda! dala as in lho Import lho array of dala Boxes limn lho spocificd file:. Find lho monbcr ofeii:IIIC!liS in r:very I>Jx o..:ideiflhalpoinlisal ora 1'111 lho si: oflho da!a Pul evcybax. per coiiDIIl ofd:lla. in one Q lilo inlo 3llllha array. large array Pu!lho docodcd daJa in an Add surassi\1: COJUITDIS anay. El>:alc lho dala as Malct v.avelct dai:L Find lho Ccnta Froquoney l Find lho Bmlwidlh rFind MoriCI Wavolet Binary Matti>; Cnalo of noisy dala Fmdcr.&cr, 0110 Add noisy dala ID tho Encoded Dala 14
PAGE 26
3.1 The Get Data Utility The Get Data function of the algorithm simply opens the ASCIT text data file containing the matrix of binary data and reads the data into the current instance of the algorithm. If the user changes the binary matrix in the data file, then the algorithm reads the new data when the data is plotted. The Get Data function closes the data file when it is finished reading the data, and the binary matrix is fed into another array, indicating the size of the data matrix. Table 3.11 shows how the data file is organized. The table can be any (M x N) elements and is only limited by algorithm or machine performance. 15
PAGE 27
Table 3.11 Binary Matrix Data File 1 1 0 1 1 1 1 1 0 1 0 0 1 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 1 0 0 3.2 Calculate Morlet Wavelet Utility The Calculate Morlet Wavelet algorithm calculates the wavelet for each data point in the array, and the results of this part of the algorithm are independent of the data encoding portion of the algorithm. The Calculate Morlet Wavelet algorithm is used to formulate a basis for determining the size of the rectangles. It calculates the center the bandwidth (u(J)), the time center (u) and the time width (aJ for each data point. This data is used in the Create Boxes utility. This utility finds the start and end point of every rectangle. For every rectangle, 'x' is defined as the 16
PAGE 28
start point in time, 'y' is defined as the start point in frequency, 'w' is defined as the width of the rectangle in time, and 'h' is defined as the bandwidth of the rectangle. atlh u and a; are known from the Calculate Wavelet algorithm, then x = (u w=io;land h=iawl Each ofthese values is put into an array, which represents an array for every data' point. There is an array for the x, y, w and h points. Adding small values to every value of O"wcan control separation between each rectangle. The Create Boxes utility also plots the center frequencies of each data point. If the data point is a zero, a 'o' is plotted. If the data point is a one, a'*' is plotted. This allows the user to easily distinguish the data in graphical format and it indicates the exact location of (a;, a,J. Figure 3.21 demonstrates how the Morlet wavelet is calculated in the Matlab language, and figure 3.22 demonstrates how the wavelet values translate to create rectangles. Figure 321 The Morlet Wavelet Uility for kcl:size(s,2) iterate number of columns in dataFile.m ws(k)=Wo/s(k); 'initial center freq, 2ach row cf dataFile.rn, Bs(kl=Bo/(s(k)) vaiue of BW for rows of dataFile.rn, f(k)=(ws(k)/pi); 'l; find the frequency alue T!k.i T (k) =1/ f (k) ; '!. a ternporar} value of time. zeta = ( (ws (k)) /pi ) ; CenterFreq sigmaw= (Bs (k) /pi); % Sa ql(k)=(T(k)bl)/s(k); the Morlet ::avelet pl(k)=((ql(k)A2)/2); %fer the tlcrlet waJelet calculate the Morlet morl(k)=(l\sqrt(s(k)))*(exp(pl(k))) .cos(S.*ql(k)); sigmat=abs (morl (k) s (k)); TirneWidth u=( T(k)+(sigmat/2) ); \; Tirnecenter 17
PAGE 29
Figure 3.22 Create and Plot Boxes Uility Find start and point of boxes x=(u(sigmat/2l)*(s(k)); tin1e start point of the first. y= ( ( zeta(sigmaw/ (2) ) l l ; w=abs(sigmat)*(s(k)); h=(abs(sigmaw)); % frequ start point of the first box ehe width of the first box in time the of the first box in rows and of input as Bvxes 'i; Colu:nn is a ve:tor to column (ki. if (colCntr == k) Column=dataFile(:,colCntr); V=U*(S(k)); t; st:t Time Center= neYJ variable, v while (rowCntr <= dataSize(l)) Elmt=Column(n); X= (v(w/2)); r: value of ea:h element in the :ol u:mn, & find x based on v. ,. put. all ;.:' s in arra:,; xA(rowCntr,colCntr)=x; wA(rowCntr,colCntrl=w; cxA(rowCntr,colCntrl=x+(w/2); trans=wA(rowCntr,colCntr)+l.S; put all ws in array % put center of bozes in an. ar:ray control separation b/w boxes. Plot Center Frequencies of Boxes if ( (w+x) < max(max(et)) l t if the be:.; is in the tL"!Ie range rect=(rectangle('Posit.ion', [x y w h))); rectangle the rectangle on a log scale. semilogy_(rect*. 02); xlabel ('Time'); ylabel ('Frequency' l; if (Elmt == 0) end plot(v,zeta. 'bo'); else plot(v,zeta,'b*'); end v = v + trans; oldMor = mor; oldet = et; n=n+l; rowCntr=rowCntr+l; if '0' plot a 'c' plot a 'Y' end 'i:end while rowCntr <= dataSize {1) colCntr = colCntr +1; rowCntr=l; n=l; end end % end if (cclCntr == k} end for k=l:size\s,2) 18
PAGE 30
Figure 3.23 represents energy as a rectangle. The concentration of energy on the (t,ro) axis changes with the rectangle position and scale, while the magnitude of energy remains the same. a(!) is the frequency interval size, or bandwidth, and O"t is the time interval size. The wavelet's energy is concentrated in a frequency interval, defined by the rectangle, whose size is scaled by (s) in the time axis and (lis) in the frequency axis. When s varies, the height and width of the rectangle change size, but its area remains the same. In order to demonstrate this, figure 2.21 is drawn on a linear scale axis, however, so that the rectangles are shown at a constant height, figure 3.23 is drawn with a frequency axis on the log scale [1]. Figure 3.23 represents energy for Is and Os. An 'o' represents a 0 data point and a'*' represents a 1 data point. Each data point is represented at a certain center frequency and center time point. Figure 3.23 Rectangles Representing Energy 2 10 t:: ::::::::::::::::::::: ::j:::::: :::::: j:::::::::::: j: ::::::::::: j ::::::::::::, I : : : : : I 101 h: ::::::::::1:::::::::::: h: :::::::::: i:::::::::::: i::: :::::::: 1::::::::::: :::::::::: :::::::::: :::::::::: j: :: :::::::::!::::::::::::1 f::::::::::: : ::::::::::::: :::::::::::: : :::: i::::::::::: :l 0 10 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::"l ....... .. :. ... . . :.... . :... . .. ... . ; .. .... . 1 : : ... . .. : .... .. .. : . ..... . .... : .. ... ....... .. . 10.1 ._I 0 20 40 60 19 I 80 100 I I 120
PAGE 31
3.3 Encode Data Utility The encode data utility, represented in figures 3.31 and 3.32, is the main part of the algorithm and utilizes equation 2.16. In the Matlab algorithm the variable "b" is the translation in time, b =(Box start +.!_Box width), and it is the center of each 2 rectangle. The value "a" is considered the scale, and it changes for every center frequency. The variables "p" and "q" are intennediate variables to ease program readability, and they hold the values oftime minus translation divided by scale. If the element is exactly equal to the first rectangle and the rectangle lies completely within the specified time range, then the Morlet wavelet is calculated for the first rectangle. The rectangle parameters are used to calculate the wavelet results and the algorithm uses one large matrix to capture the rectangle data, sum the data and plot the wavelets. The encode data utility transfonns the data into an analog signal and transfers the signal. This is demonstrated in the graphical user interface by plotting the data against time and correlating the signal with the rectangles. For all rows and columns of data, the utility places the Morlet wavelet data of every rectangle in an array called 'allMor.' The length of the 'aliMor' array is the same length as the time span shown in the graphical user interface, so the values of the calculated Morlet wavelet for each Heisenberg Uncertainty box is place at the appropriate time, and zeros are elsewhere. 20
PAGE 32
Figure 331 Create Basic Wavelet Utility b: ( (X+W) W/2); 1; the translation, b a=(y/(y+h))*s(k); scale q=(etb)/a; '\ for the m.orlet wa.,,.elet equation p:( (q. A2) /2); r for the mer let wavelet equation \; if element in the dataFile is a 1 S: it exists t:/in the channel S:; find the ffcrl.:t waveform for each bcx if (Elmt == 1) & ( (w+x) < max(max(et)) mor=(l/sqrt(a))*(exp(p)).*cos(S.*q); else othert!ise just set it equal to :::ere. mor=zeros(size(et)); end Figure 332 The Encode Data Utility if roWCntr > 1 't Put all morlets in an array allMor(colCntr,:)=allMor(colCntr,:)+mor; else allMor(colCntr,:)=mor; '; Put all morlets in an ar:z:ay end Figure 3.33 shows the encoded data file plotted in analog form, utilizing the Morlet wavelet transform. This represents the data with no noise added to the signal. 21
PAGE 33
Figure 3.33 Encoded Data .. . . . . . . . . . . . ... I I ! 1 ::::. . . . . . . . . . 1.5 ''"' 0 100 120 3.4 Add Noise Utility Adding noise to the encoded data begins on the graphical user interface with the input slider called 'Noise.' The file 'wgui' defines the graphical user interface (gui), and the definition of the noise slider is shown in figure 3.41. The graphical user interface is described in detail in section 4.1. When the slider is activated, the callback 'svcback' is returned to Matlab, where the function in figure 3.42 is called, and the value appears on the gui, below the slider. The 'gca' function returns a handle to the current axis, so that the axis that the encoded data is plotted on is known to the function. The 'num2str' function converts the number obtained from the slider into a string. The 'svcback' function opens a file, 'templ.m' and places the string in that file. Each time the slider is activated, a new number overwrites the previous number in the templ.m file, then closes the file. Figure 3.43 22
PAGE 34
demonstrates the 'load' utility where the slider value is loaded into the current instance of the algorithm. This value is placed into the variable 'AnsNoise,' and if the value is zero, the entire summation of the encoded data, named 'total,' is plotted. If the value is not zero, the value is put into a function called 'nonnrnd.' This function returns a matrix of random numbers chosen from the normal distribution with input parameters 0 and AnsNoise. The function, shown in, 'R=nonnmd(O,AnsNoise,l,size(total,2))' returns a matrix of normally distributed random numbers. This matrix is added to the encoded wavelet data file 'total.' Then the entire matrix, with noise or without noise, can be plotted. Figure 3.41 Noise' Slider Graphical Uer Interface h1 = uicontrol('Parent',hO, ... 'BackgroundColor', [0.847058823529412 0.815686274509804 0.784313725490196], . 'Callback' ,'svcback', ... 'Lis tboxTop' o, . 'Max' ,0.5, 'Position', [20.5 263 44 20], 'Style', 'slider' ... 'Tag','AZslider', ... 'TooltipString', 'Add noise to the Encoded Data'); 23
PAGE 35
Figure 3.42 The 'svcback' Function \:: % 'svcbac .. m This function is for the Encode data s1 .. idcr values function svcback() =).; function :::all Hc_az=findobj(gcf,'Tag', 'AZslider'); t define a object Hc_cur=findobj (gcf, 'Tag', 'AZcur'); 1:< put the value of the slider obj in He cu:r:. str=num2str (get (Hc_az, 'Value')); 'r convert the number tc a string num=get(Hc_az,'Value'); the value of into 'nU?.,' set(Hc_cur, 'String',str); w.::ite.s the t.o :.he t.e:r.t bo:: fid = fopen('ternpl.m', 'w'); t open the templ.m file COUNT= fprintf(fid,'%3.3f\n',num); the value in the file fclose(fid); the file. Figure 3.43 The 'Add Noise' Utility get the noise value frorn the 'templ.rn' file, comes from the slider in ... : the gui .. load templ.m; AnsNoise=templ; if AnsNoise==O put that value into a new var called AnsNoise if is no noise, just plot the else R=Nan nothing to plot. total=sum(allMor); else total= sum (allMor) ; % if there is noise, add noise to total & plot. R=normrnd(O,AnsNoise,l,size(total,2)); total=total+R; end figure(l);plot(et,total);grid; 24
PAGE 36
Figure 3.44 Noisy Encoded Data 1.5 0.5 0 I I I" I I ______ J _____ I I I I I I I I I I .1 I I .5 L......J'_._ ____ _.._ ____ _.__ ____ ..___ __ __,_ ____ _, 0 20 ED 100 120 Figure 3.44 shows the encoded data file plotted in an analog form, utilizing the Morlet wavelet transform. This represents the data with noise added to the signal. 3.5 The Decode Data Function The Decode Data function, shown in figure 3.51, finds the original binary data from a noise free or noise filled wavelet. For every column of data in the data file, the function counts to the end of the channel's time period, as well as the end of the last rectangle's center point. If, for some point, the difference between the value of the current point in time and value of the rectangle center is less than a small value, then that point is called 'qCnter.' 'qCnter' represents the center of the current rectangle and it is placed into an array called 'BoxCenElements.' The array is used as a convenient way to verify that the centers ofthe 25
PAGE 37
rectangles were foWid. The center point of each rectangle, "qCntr," is used in the continuous wavelet transform ( cwt) function. The cwt function finds the coefficients of the continuous wavelet transform. The cwt function imports the swnmed total of wavelet functions in the channel, including any noise added to the signal, and, by application of equation 3.1, finds the coefficients of the continuous wavelet transform array. (3.1) The coefficient values are measurements of the energy, associated with each wavelet transform W;6if. Where, for every wavelet in the timefrequency plane, (f,'fl'r) is the wavelet coefficient, and 'fl'r is a unit vector. (j) represents the signal and is projected on an ndimensional orthogonal space, where n represents the number of wavelets in the signal. If (/, 'fl'r )'fl'r is relatively small, the result is negligible. The dependency threshold defining what constitutes large and small values can be adjusted on the graphical user interface. The coefficient energy values returned are very small values if the discrete data matrix has a zero value, or they are very large values if the matrix has a value of one. The dependency threshold of the large and small magnitudes can be adjusted. The user may need to adjust the threshold, depending on the amount of noise in the signal. By utilizing a value imported from a user interface slider utility, the user may select a threshold, and the algorithm compares each values of the 'cwt' energy array with this threshold. If the number returned by 'cwt' is equal to, or greater than, the threshold, then a value of 1 is placed into a new array called 'Decoded _Data.' If the value of the number returned by the cwt coefficient array is less than the threshold value, 26
PAGE 38
then a 0 value is placed in the Decoded_Data array. By varying the threshold values, along with the noise value, one can adjust the robustness algorithm given a certain level of the noise in the signal. 27
PAGE 39
Figure 3.51 The Decode Utility % decode.m' Finds the original binary data from unnoisy or from noisy wavelet. Fo.!: every colurnr. of data in data file, the function counts until the end of the channel's tLne period, counts until the end of the last % boY.' s cente.r point. The: function the tot.:l of \o;avelet functions in channel, including noise added to the signal finds the coe fficie:nts of the continuous let tz:ansfoz::rn ar t:ay. The coefficient energy values returned are r."ery small values if the discrete data matrix has a zero value, or are .... large values if % the has a value of 1. The threshold of the laz:ge a.:.d small % value magnitude can be adjusted. !t load temp2.m; tbresh=temp2; 'The Data is Decoding' t Deccde mCntr=l; for rowCntr = l:1:dataSize(2) every column, do the follctling. qCntr=l; % set up another counter q. % trhile (q ...:;.= Time} & tm <= rO\i Si:e of czA} % if diff b/w s:11ne pcint in ti!ne and value of Be:: center <. 001 & .:alue of Bo:#: center >. 0001 while (qCntr <= size(et,2)) & (mCntr <= size(cxA,l)) if ((et(qCntr)cxA(mCntr,rowCntr))<.OOlS) & ((et(qCntr)cxA(mCntr,rowCntr))> .0001) l:put elerr.nt of Boxc:ent.r in an array called Bc:ccenELTUts BoxCenElmts(mCntr,rowCntr)=qCntr; i: Find the coeffients of the wavelet transfcnn 1 t.otal' coeffs(mCntr,rowcntr)=cwt(total(l,qCntr) ,s(rowCntr), 'marl'); if (coeffs(mCntr,rowCntr) >= tbresh) Decoded_Data(mCntr,rowCntr)=l; else Decoded_Data(mCntr,rowCntr)=O; end mCntr=mCntr+l; end qCntr=qCntr+1; end mCntr=l; end 'Push "Output File" to see the decoded date.' 28
PAGE 40
3.6 Signal to Noise Ratio There are several aspects to the determination of Signal to Noise Ratios (SNR). First, there is the receiver model, which provides an adequate description of the receiver noise, which accounts for the inherent filtering and modulation characteristics of the system. The 'Encode' segment of the algorithm provides a receiver model. Second, we in.ust add the noise to the transmitted signal. The receiver model accepts the summation of the signal and the noise. The SNR utilizes average power of both the signal and the noise. SNR is a ratio of the signal's power to the noise power. The average noise power at the receiver is equal to the total area under the signal's power spectral density, or SN(j). With the signal and the noise appearing additively at the receiver, the SNR is defined a ratio of the average power of the signal to the average power of the noise. The signal to noise ratio provides an intuitive measure for describing the fidelity with which the decoding process recovers the message signal from the encoded signal in the presence of additive noise. For such a criterion to be well defined, the recovered message signal and the corruptive noise component must appear additively at the receiver. In the Operations section of this paper, specific SNR examples are provided, which demonstrate the high fidelity of the algorithm. In any case, the following equations are used in the signal to noise process. The average power, P, is the total area under the curve of the signal and is given by: P = fsM(f)df (3.2) 29
PAGE 41
The SNR is given by: P. I SNR = signa pnoise 30 (3.3)
PAGE 42
4. Operations 4.1 Graphical User Interface The encoding and decoding waveletbased algorithm is represented by a graphical user interface. The interface is based on Matlab software and the user interacts with a combination of the graphics and Matlab command line output. After executing Figure 4.11 The Graphical User Interface J ,Fogure No 1 l t I I :: .. ': ; .:{ <... :::::: :::::::::: ::::::::: .\i;_ .>. .. .. ..... .... , .. __ ...,...,....,....... ,_.,._,,....._, __,_..J..,.,,::',,.,...,. : .. . 20 : : 60' llJ . 10CI ,, 12Q ' Matlab, the user enters the command "wgui," which is an acronym for Wavelet Graphical User Interface. Matlab returns the interface as shown in Figure 4.41; The interface comprises three main sections. The large graphing area in the center of the interface is used to show how energy of discrete data is distributed over a finite area along time and frequency. This area represents rectangles in the channel. 31
PAGE 43
The top area represents the encoded wavelet data. Discrete data is converted to continuous analog data by utilizing wavelet transforms. Each wavelet is summed along the frequency axis and the total is plotted in the top graph area. The top graph area represents the encoded data that is securely transmitted to intended recipients. Noise may also be summed in the signal and transmitted. Along the left hand side of the interface are the controls of the data, and give the user the ability to input parameters, encode the data, represent energy, and decode transmitted data. 4.1.1 Input Parameters The "Data File" control button allows the user to open, manipulate and save the discrete input data file. The second control button, "Graph Data," reads the discrete data file in the interface by plotting rectangles on the main graphing area and it brings the discrete data into memory for use by other controls in the interface. Figure 4.1; 11 shows the discrete data represented as rectangles. The data file this I graph represents contains 3 columns of data and each column of data is plotted at different bandwidths along the frequency axis, as demonstrated in figure 4.1.11. 32
PAGE 44
Figure 4.1.11 Discrete Data Representation 1 F1gu1e No.1 1!!!11!1 E] ee : &dl :roots J::!elp ) . 1._ ... I J )o:s ..... I .. I I .. . .: ; I t I .............. : ............. J ............. J ................ ............. L ............ I I I I I 1 I I I I I 0 o o 6(T :eo .100. Time The first column of data, shown in Table 3.11, is plotted at a center frequency of approximately 1.31. The second colwnn of data is plotted at a center frequency of approximately 0.656. The actual values of the center frequencies can be found by typing the command "zetas" on the Matlab command line. The center frequency is based on the equation ro0 = 1jrollf'(V)I2 dlV, where lf'(V) is the Fourier 2tr 0 Transform of the basic wavelet in equation 2.6. Therefore, the center frequency is also dependent on scale, or Vs= aJo /scale. The Bandwidth is represented by the height of the rectangles along the frequency axis, and is equal to equation 2.11, or ( WmaxWmin)/scale. The bandwidth becomes larger as the scale decreases. The centers of each rectangle can be obtained by typing "cxA," and each rectangle width can be obtained by typing "widths" on the Matlab command line. The bandwidth 33
PAGE 45
for each rectangle can be obtained by typing "wA." The position of the rectangles along the time axis is based on the number of rectangles that can fit in the allocated time range. Since the total energy of the rectangles must remain constant, as the bandwidth decreases, the time range of that rectangle must increase. As the value of center frequency decreases, the time range for each wavelet increases. Since there is only a certain amount of data which can pass thorough the channel in any given time period, the time range does not change as the number of discrete rows of data increases. Therefore, the interface represents a defined time period, the decoding utility decodes data for the given time range :and future work may consider synchronizing continuous bit streams. This work might consider the given time range of length (n) as a bit packet, process and decode the packet from the indicated start of the data file to the end of the data file. 4.1.2 Encode Data The next set of controls in the interface allows the user to encode the data and it allows the user to add noise to the data. Every discrete data point, and hence every rectangle represented on the timefrequency axis, is encoded using the Morlet Wavelet function. This function is represented in equation 4.1 below. 1 (tu)1 << )t )212 'l'r =If!=e tu s cos((J)(tu)ls) .[; s .[; (4.1) This equation is exponential in time, t, translated by u, with frequency (J) and scale (s). Each column of the discrete data matrix is encoded and placed into a matrix. This 'Morlet matrix' transposes the data in the data matrix file, and contains the same number of rows as there are columns in the discrete data file. It has the same 34
PAGE 46
number of columns as there are rows in the discrete data file. After the last data point in the matrix data file is encoded, all the rows in the Morlet Matrix are recursively summed together. For example, row 2 is added to row 1, then, this sum is added to row 3 and so on. The total of this sum is plotted in the upper graph area of. It can be seen, in figure 4.1.21, there are 1 's in the discrete data file, and hence the rectangles, a corresponding wavelet exists in the encoded data. Where there are zeros, there is no corresponding wavelet. Figure 4.1.21 demonstrates the encoded data with a zero value for noise. If noise is added to the data, as in figure 4.1.22, then the value of the noise shown under the noise slider and, after the "Plot Morlet'' button is pushed, the encoded data, with noise is plotted in the top graph window. 35
PAGE 47
Figure 4.121 Encoded Discrete Data .;.. .. .... :.. .... r.. ............. ............. I I t I I I o o .............. ,I I i 1 I I I I ,:.,: Figure 4.122 Noise Added to Encoded Data J Frgure No 1 . .... J.: .... .. ................ .... l... .. 1 I I I t I 0 I 20 40 60 100 .120 36
PAGE 48
Noise is added to the data by utilizing the Matlab function "nonnrnd." It produces a matrix of random numbers chosen from a normal distribution. The size of normrnd is the same size as the total summation of the encoded signal. This allows the two vectors to be added together and plotted. 4.1.3 Energy Detection & Noise Rejection Shown throughout this paper is the concept of energy represented as rectangles. Utilizing wavelet transforms, this energy is encoded into analog form. The encoded signal may be transmitted, and once the intended receiver collects it, the signal may be decoded. Because the encoded signal representsenergy, an energy threshold detector is used to recover the bits from the signal. The energy threshold detector measures the energy of the wavelet transform ( '1/u.s(tJ) of each rectangle MxN Region. This region is defined as RMxN. The energy of the encoded signal is: eM:rN = R.,ax (4.2) "TIf eMxN is greater than a certain constant value, or threshold, then the amount of energy can be considered equal to the value 1. Otherwise the amount of energy is considered equal to 0. The constant value threshold can be estimated by a determination of energy for each wavelet, however, adjusting the a value may be the most appropriate method in many cases. The coefficients are very small values if the discrete data matrix has a zero value, and are very large values if the matrix has a value of one. The dependency threshold defining what constitutes large and small values can be adjusted on the user interface. 37
PAGE 49
Noise rejection utilizes a threshold concept similar to that of Energy Detection. A signal is thought of as 2 parts: the first being the encoded signal, and the second being the noise. The encoded portion is defined by the transformation of digital data into analog data. Through utilization of wavelet transformation equations the energy is distributed among lmown functions. Conversely, the noisy portion of the signal will spread its energy throughout the timefrequency plane, and the coefficients associated with the noisy portion of the signal are small compared to that of the encoded portion. This being known, one can set a threshold, filtering the noisy data from the encoded data. 4.1.4 Bit Recovety After the encoded signal, including noise, is transmitted, it must be decoded into the original discrete data. Bit Recovery must occur with a low bit error rate given different levels of noise added to the original signal. The Decode Data function finds the original binary data from the encoded signal, with variable noise levels. The cwt function is used to find the coefficients of the continuous wavelet transform. As described in section 3.6, the cwt function imports the summed total of wavelet functions in the channel, including any noise added to the signal, and fmds the coefficients of the continuous wavelet transform array. The threshold value that is used to determine which coefficients represent a one can be used to adjust the robustness ofthe algorithm. The addition oflow level noise to the encoded signal creates random low level spikes to the original signal, and as such, a large Threshold level is not required. However, if a large level of noise is added to the system, larger random spikes are added to the signal, and the threshold may need to be raised to compensate for higher spikes in the signal. Since noise and encoded data are additive, where a wavelet exists, a high level ofnoise creates an even 38
PAGE 50
greater frequency. This process requires engineering judgment. Noise is added to the signal, and an unchanging threshold values produces inaccurate results. The threshold must compensate for higher magnitudes of noise. Figure 4.1.41 shows a small noise level, of0.05, added to the signal, and a Threshold level of0.027 is defined. The signal to noise ratio (SNR), as described in section 3.6, is 1.8970e+005, which demonstrates a very high fidelity, and gives an indication that the decode algorithm should result in very accurate results. After the data is decoded, the Matlab command line reports the pending status "The Data is Decoding" until it is finished decoding and the message "Push 'Output File' to see the decoded data" appears. When this button is selected Matlab prints the output data matrix "Decoded_Data." The output is shown in Table 4.1.41, and the I decoded data is very accurate. The noise level increased to 0.395, as in Figure 4.1.42, the Threshold level is increased to 0.245 .. The signal to noise ratio (SNR), as described in section 3.6, is 76.5486, which demonstrates a lower, but still, fair This result gives an indication that the decode algorithm should result in fair results. 39
PAGE 51
Figure 4.1.41 Encoded Data with Reduced Noise I F1gure No 1 l!f[!]t:i ___ I I I I I :.. ::_.!I I I I I I I I I I I 40 ,69 :eo liri'ie 100' .. ',
PAGE 52
Table 4.1.41 Decoded Data Eiloi ... .:"' Mew ':"'...,_. !ie!P' _. _. '... .. Jo ,x. {illhra 1 .; 11111 a 1 DecadPd_Dat:a 1 .. .. 1 1 D D 1 D D 0 .. 0 0 D .. 0 0 D ., 0 D D .. 0 0 D .. 0 0 0 0 0 0 D 0 0 0 1 ., 1 D 0 D .. D D 0 .. D 0 D 0 _j . .... 4 Figure 4.1.42 Increased Noise Level ' 10:1L__ _..,_ __ __. ___ .__ __ _._ __ __. __ J 0 20. 40 60 El) 100 120 Time 41
PAGE 53
It can be seen from table 4.1.42, that the bit error rate is fairly accurate. However, in the third column it can be seen that a 'I' exists in the first row, where there should be a '0.' If the Threshold level is adjusted up or down, the decoding algorithm begins to fail in other locations of the matrix. Therefore, the amount of noise is quantifiable. However, overall the algorithm is very good at determining the original discrete data from the noise embedded encoded analog transmission. Table 4.1.42 Decoded Data Degradation @COd@d_Dat:a :".A 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 _j 0 0 ' ,_,_,_ '' ,,M 42
PAGE 54
5. Conclusion Wavelet transforms provide the ability to parse the timefrequency domain into smaller atomic parts, allowing for the decomposition of discrete data into smaller units of energy. These units of energy are distributed over the timefrequency domain and are represented as rectangles, which characterize the localization of energy. Wavelets functions are not only used to find these units of energy, but are also used to transform these units of energy to analog form. 1bis transformation encodes the discrete data in preparation for transmission. Before, or during transmission, the encoded signal will acquire random spikes of energy, or noise. It has been shown that the intended receiver of the signal can employ wavelet transforms and threshold values in the decoding process, and the receiver can reject noise in the signal, leaving the original discrete data. By adjustment of the noise level and by adjustment of the decoding energy threshold level, an optimal combination of these parameters is found. This combination will reveal the original data, while compensating for certain noise levels, with low decoded bit error rates. These concepts take into consideration multiple users per channel. A portion of the timefrequency domain can be considered a channel, where multiple users, each utilizing a different frequency, transmit bits of information. 1bis paper implements the solutions to the abovedescribed problems in an algorithm. There are eight main parts to the algorithm including the binary matrix data file and the Get Data utility, which retrieves the data. The Calculate Wavelet utility finds the wavelet, finds the center frequency and bandwidth of each data point, and finds the time range of energy distribution. Once the wavelet and energy distributions are known, the algorithm finds the beginning and ending points for each rectangle and it plots the rectangles in the timefrequency domain .. The Encode Data utility utilizes wavelet functions, and the discrete data is encoded into an analog signal. The Decode Data 43
PAGE 55
utility not only transforms the encoded data into its original discrete form, but it also filters any noise associated with the transmitted signal. The Decode Data utility uses wavelets to transform the signal. It is shown that there are limitations to the decoding utility, and a combination of noise level and energy threshold level is necessary to avoid high bit error rates. Noise exceeding particular levels, depending on the amount of data and energy thresholds, produces errors at any threshold. Nominal, acceptable levels of noise, however, are well within reach of low bit error rates for this algorithm. The algorithm provides a graphical user interface as only one application for these utilities. 44
PAGE 56
APPENDIX A; Matlab Computer Programs 45
PAGE 57
% o/o o/a '0 /o% %o/o%1 o/o% o/o% 1%o/o 0/o%1 .. ,0 cro 0/c'tO o/a'tO o/c=:o o/o 'io 0/o0/o Cfc 0/o 0/o% 0/c o/o 0/o 0/a 0/o o/oo/o% %% 0/c%% o/o '%% '% % 0/o 0/o o/o %1% 'Q o/o o/o o/o 0/o o/o 0/o o/o 0/o o/o o/o 0/o o/o% o/o o/o C/c0/o Cfc0/o Cfco/o o/c o/o0/oo/o %o/o o/o o/o o/o o/o0/o 0/o o/oo/o% o/o 1% o/c o/o 0/o% %%%%%%%%%% % % 'Analog.m' Plots the Analog version of the dataFile utilizing transforms. % %This file imports binary data from another file (dataFile.m). This file creates % arrays for each column of data and computes the start and end location for each % box per column of data. Then each box is represented as analog Morlet Wavelets. % The wavelets are added together to for a continuous transformation for all boxes %as analog. % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% o/ao/o 0/o%0ioo/o o/o .:./o o/o% %% %o/o 0ho/o%% o/o% o/o %0/c0/0o/o%o/e o/o o/c o/o o/c% %:%0/o% o/o o/o '% '% o/o o/o o/o "t0%1o/o o/o o/G %0/o% o/o%o/o %o/o c/o%% o/c %%%%%%%%%%%%%%%%%%%% clear % GE'r DATA *""....._load dataFile.m % Go to the matlab fils named "dataFile.m" and bring the data into memory. dataSize=[size(dalaFile, 1) size(dataFile,2)]; % put the size of the dataFile into another array. % ..... ....... ... set Scale and time period (et) step size ............................ . scale=1.213 %'scale' is a constant value multiplier s=1 :1 :dataSize(2); % 's' is just a counter up to the number of columns in the data File s=s'scale % now makes some multiple of scale. stepSz=.001; % a constant step size. allowing us to easily change this value throughout the program et=O:stepSz:120; % et is time. %_ ...._.. _.. ........... Set up global array variables ........... ............... ... % initialize array of zeros fer: ws=zeros(1 ,size(s,2)); Bs=zeros(1 ,size(s.2)); f=zeros(1 ,size(s.2)); zetas=zeros(1 ,size(s.2)); xA=zeros(1 ,size(s,2)); wA=zeros(1 ,size(s,2)); cxA=zeros(1,size(s,2)); widths=zeros(1,size(s,2)); BoxCenclmts=zeros(1 ,size(s,2)); mor=zeros(1,size(et,2)); a11Mor=zeros(1,size(et,2)); zeta =0; sigmaw=O; y=O; h=O; % Center Frequency % Bar.dv.idth % frequency o/o Center Frequency % x point or start of box % width of box in frequ % center of box in time % width of oox in time % the elements at box center % Morlet Morlet for each column of data in dataFile % CenterFreq %Bandwidth o/a ....................... .............. Initialize other variables ...... __. ___ _. .....,..., ..,_ ______ .... LstBoxcndPnt=o; rowCntr= 1; coiCntr= 1; n=1; b1=0; Wo=S; Bo=1.701; % Last Box End point % Count number of rows % Count number of columns % inil n. a counter % initial offset % initial frequency % initial bandwidth % ........... ........... For Boxes Only: Calculate the Mortet Wavelet .... ,_, .. ......,.,_ %iterate though t.'1e number of columns in the dataFile.m \. for k=1 :size(s,2) ws(k)=Wols(k); % lind initial value of center frequency for each rcw of the dataFIIe.m, base on s!k) 46
PAGE 58
Bs(k)=Bof(s(k)) ; f(k)=(ws(k)fpi); T(k)=1ff(k); %find iniUal value of bandwidth for each row of lhe dataFile.m, base on s(k) %find lhe frequency value (only used for i(k) % a temporary value of time. zeta =( (ws(k))fpi ); % CenterFreq sigmaw=(Bs(k)fpi); % Bandwidth q 1 (k}=(f(k)b1 )fs(k); % ior the Meriel wavelet p1 (k)=((q1 (k)"2)12); % for the Morlet wavelet % calculate the Morlet wavelet mor1 (k)=(1\sqrt(s(k)))(exp(p1 (k))). "cos(S. q1 (k)); sigmat=abs(mor1 (k)"s(k)); % TimeWidth u=( T(k)+(sigmat/2) ); % TimeCenter o/o ...... .... _..... ............ Create Boxes ._ ........... ,.. ............ ........... % Find the start and end point of boxes x=(u(sigmatf2))(s(k)); % the start point of the first box in time y=( ( zeta(sigmaw/(2)) ) ); % the start point of the first box in frequency w=abs(sigmat)"(s(k)); % the \'Vidth of the f1rst box in time h=(abs(sigmaw)); % the width of me first box in frequency % rows and columns of input dataFile as Boxes if (coiCntr == k) Column=dataFile(:,coiCntr); % Column is a vector exactly equal to the cciumn(k). This mcreases the column number v = u"(s(k)); while (rowCntr <= dataSize(1 )) Elmt=Column(n); x=(v(w/2)); xA(rowCntr,coiCntr)=x; wA(rowCntr,coiCntr)=w; cxA(rowCntr,coiCntr)=x+(w/2); trans=wA(rowCntr,coiCntr)+1.5; v= v+ trans; % set the Time Center, equal to a new variable, 'v' % Elmt is the value of each element in the column. % find x based on v. % Store all x's in an array the same size as the dataFile array % Store all w's in an array the same size as the data File array % Store all center of boxes in an array the same size as the data File array % Cor.trol seperation between boxes. b=((x+w)w/2); % the translation, b a=(yf(y+h))"s(k); % scale q=(etb)fa; % for the morlet wavelet equation p={(q."2)12); %for the morlet wavelet equation if (Eimt == 1) & ( (w+x) < max(max(et)))% if the element in the dataFil is a 1 & it exists wlin the channel mor=(1/sqrt(a))"(exp(p))."cos(5.q); % find the Morlet waveform for each box else % ctherNise just set it equal to zero. mor=zeros(size(et)); end o/o .. Analog repiesentation of each Box) .,...,...... if rowCntr > 1 aiiMor(coiCntr,:)=aiiMor(coiCntr,:)+mor. % Put all mortets in an array else aiiMor(coiCntr,:)=mor; % Put ail morlets in an array end oldMor= mer; oldet = et; n=n+1; rowCntr=rowCntr+1; end %end while rowCntr c= dataSize(1) coiCntr = coiCntr +1; rowCntr=1; n=1; end % end if (coiCntr == k) 47
PAGE 59
end %end for k=1:size(s,2) % "' ...... _... ._ ... ......... Add Noise .............. .. ... load temp1.m; the gui. AnsNoise=temp1; if AnsNoise==O total=sum(aiiMor); else total=sum(aiiMor); R=normmd(O,AnsNoise,1,size(total,2)); total=totai+R; end figure(1 );plot(et,total);grid; o/o get the noise value from the 'temp1.m' file, comes from the slider in % put that value into a new var called AnsNoise % if there is no noise. just plot the total. Required. else R=Nan & nothing to plot % if there is noise. add noise to total & plot. 48
PAGE 60
o/o o/o o/o o/:, ,.0 o/Q%% 0/o 0/c%% 0/o o/c '/o 0/c '% 0/o 0/il '% o/o '%0/o 0/a0/o 0/c0/o o/c 'lo 0/oo/o% =>tO%% o/o 10 /o %,0/ao/o o/o o/o o/o% 0/:.%: o/v% %% 0/o 0/o o/oo/o 0/o 0/o :)/o% %t'O o/o /oo/o %0/o0/o 0/o 'lo 0h o/o% o/o0/o% 0/o %o/.,% o/o% %,, %o/o% o/c 0/o 0/o o/c, 0/oo/Q o/c% 0/o o/o 0/o o/o o/o o/o o/o %;0 o/o o/o o/o o/o% 010%.% o/o o/o%o/o.,/c% %% Cf& o/c% o/oo/o o/o %%%%%%%%%%%%%%%%%%%% % % 'boxes1.m' % This file imports binary data from another file (dataFlle.m) and plots % boxes. Each column of data is displayed as a row of boxes. % o/o% o/o o/o% o/:. %0/o% o/::!% o/a '%o/o %o/oo/oo/o% o/o o/c% o/c0/o 0/oo/o 0/Q o/o o/o o/o %o/o %o/o% o/o o/oo/o o/o %o/ao/.:% o/c0/o% %%%%%%%%%%%%%%%%%%%% % o/o :J/o0ko/o% o/o o/o o/o o/o0/o o/o0/o o/o% o/oo/o 0/o o/o% o/o% o/o0/o 0/c% o/o% 0/o% o/:. %0/o 0/o%% 0/o% 0/o %o/o o/o0k o/o o/o0 ioo/11/o o/oo/o o/c o/o %%, o/oo/o% o/o o/o% Q/c %'Vo o/o o/o% dear load dataFile.m % Go to the matlab file named "dataFile.m" and bring the data into memory. dataSize=[size(dataFile, 1} size(dataFile,2}); % put the size of the data File into another array. .... set Scale and time period (et) step size . __.. ......_...._........ __ ......... ..._ .. scale=1.213 %'scale' is a constant value multiplier s=1 :1 :dataSize(2); % 's' is just a counter up to the number of columns in the data File s=s"sc:ale % now make s some multiple of scale. stepSz=.001; % a constant step s1ze, allowing us to easily change this value throughout the program et=O:stepSz:120; % et is time. o/o,...... ........... Set up global array variables ............. ..... .. ... ws=zeros( 1 ,size(s,2}); Bs=zeros(1 ,size(s,2}}; f=zeros(1 ,slze(s,2)); zetas=zeros(1 ,size(s,2)}; xA=zeros(1 ,size(s,2}}; wA=zeros(1 ,size(s,2)}; cxA=zeros(1 ,size(s,2}}; widlhs=zeros(1 ,size(s,2)}; BoxCenEimts=zeros(1 ,size(s,2}}; mor=zeros(1 ,size(et,2}}; a11Mor=zeros(1,size(et,2}}; zeta =0; sigmaw=O; y=O; h=O; % initialize array of zeros for. % Center Frequency % Bandwidth % frequency % Center Frequency % x point or start of box % width of box in frequ % center oi box in time % width oi box in time % the elements at box center % % Morlet Morlet for each column of data in data File % CenterFreq % Band\llidth % _._. __... ._._ __ Initialize other variables __ ............... _..._ _... ................. Ls1BoxEndPnt=O; rowCnlr= 1; coiCntr= 1; n=1; b1=0; Wo=5; Bo=1.701; % Last Box End point % Count number of rows % Count number of columns % in it n. a counter % initial offset % initial frequency % initial bandwidth o/., ............. ............ For Boxes Only: Calculate the Fvlorfet Vtlavelet _, ...... for k=1 :size(s,2) ws(k)=Wo/s(k); Bs(k)=Bo/(s(k)} ; f(k)=(ws(k)/pi); % iterate thOugh .the number of columns in the dataFile.m % find initial value of center frequency for each row of the dataFile.m. base on s(k) % find Initial value of bandwidth for each row of the dataFile.m. base on s(k) %find the frequency value (only used for T(k) 49
PAGE 61
T(k)=1/f(k); % a temporary value of time. zeta =( (ws(k))/pi ); % CenterFreq sigmaw=(Bs(k)/pi); % Bandwidth q1 (k)=(T(k)_b1 )/s(k); o/o fer the Morlet wavelet p1 (k)=((q1 (k)A2V2); %for the Mortet wavelet % calculate the Morlet wavelet mor1 (k)=(1 \sqrt(s(k)))* (exp(p1 (k))). cos(5. *q1 (k)); sigmat=abs(mor1(k)*s(k)); % TimeWidth u=( T(k)+(sigmat/2) ); % TlmeCenter Create Boxes ._... ... _... ... ___ .._..._.. % Find the start and end point of boxes x=(u(sigmatl2))*(s(k)); % the start point of the box in time y=( ( zeta(sigmaw/(2)) ) ); % ti'ie start point of the first box in frequency w=abs(sigmat)*(s(k)); % the width of the first box in time h=(abs(sigmaw)); % the width of the first box in frequency % plot rows and columns of input data File as Boxes if (coiCntr == k) Column=dataFile(:,coiCntr); % Column is a vector exac'Jy equal to the column(k). This increases the column number v = u*(s(k)); while (rowCntr <= dataSize(1)) Elmt=Column(n); x=(v(w/2)); xA(rowCntr,coiCntr)=x; wA(rowCntr,coiCntr)=w; cxA(rowCntr,coiCntr)=x+(w/2); trans=wA(rowCntr,coiCntr)+1.5; % Plot Center Frequencies of Boxes % set the Time Center. equal to a new variable, 'v' % Elmt is the value of each element in the column. %find x based on v. % Store all x's in an array the same size as the data File array % Store all w's in an array the same size as the dataFile array % Store all center of boxes in an array the same size as the dataFile array % Control separation between boxes. if ( (w+x) < max(max(et)) ) % if the box is in the time range rect=(rectangle('Position', [x y w h))); % figure out a rectangle semilogy(rect*.02); xlabei('Time'); yfabei('Frequency'); grid on; hold on; %plot the rectangle on a log scale if (Elmt == 0) plot(v,zeta,'bo'); % if the element in the data array is a o plot a o else plot(v,zeta,'b*'); % else, plot a end end v = v +trans; oldMor= mer; oldet=et; n=n+1; rowCntr=rowCntr+1; end %end while rowCntr <= dataSize(1) coiCntr = coiCntr +1; rowCntr1; n=1; end end % end if (co(Cntr == k) % end for k=1 :size(s.2) 50
PAGE 62
o/o% o/o0/o% o/Do/o% o/oo/o o/o%o/o %o/oo/o% o/o o/c%% o/c% o/o% 0/c% %% o/oo/o 0/0o/o o/o o/oo/o% o/o '% o/oo/o o/o%%% o/o o/o o/o o/c o/o o/o o/c; o/c 0/o% %% %%%% %o/o %o/o 0/0o/o %o/c% 1%o/o o/c o/o 0/,o/e %o/o% o/o% %% o/o% o/co/o o/;. o/o o/o% o/o o/o% o/c o/o c.4 o/c 0/o o/o "'o 'deccde.m' % Finds the original binary data fnom unnoisy or from noisy wavelet. % For every column of data in the data file. the function counts until the % end of tile channel's time period and it counts until the end of the last % box's center point. The cwt function imports the summed total of wavelet % funchons in the channel, including any noise added to the signal finds % the coefficients of the continuous wavelet transform array. % The coefficient energy values returned are very small values if the % discrete data matrix has a zero value, or they are very large values if % the matrix has a value of one. The dependency threshold of the large and % small value magnitude can be adjusted. % % o/o% o/o o/oo/o% '70 o/o0/o%0/o%o/o0/o% 0/c0:0 o/oo/o o/oo/o Cfc o/c% 0/o o/o 0/oo/o o/o o/o o/o o/o o/o 0/o o/o o/o o/oo/o%o/o o/oo/o%o/o o/o 0/o%% 0/c% o/c0/c; '%%o/c o/o1% 0/o o/;, %o/o %o/o0h0/o% o/o o/o o/o tl/o o/oOfct %o/o 0/o %0/o %o/o %0/oc/c :I/o%%% o/.,0/o0/c c/o o/o% o/o% o/o% o/o %%% 3/o%o/o %o/o% Q/o% %1 0/o o/o% 0/0 o/o 0/oo/o '0 o/o% o/o %%%% o/o%o/o load temp2.m: thresh=temp2: 'The Data is Decoding' % ................... _.,.,.... ___ ...,.... Decode ............... ........... ....... mCntr1: %set up a counter, m. for nowCntr = 1:1 :dataSize(2) %for every column, do the following. qCntr1; %set up another counter q. while (qCntr<= size(et,2)) & (mCntr<= size(cxA,1)) %while (q <=rna)( Time) & (m <=row Size of cxA) %if diff biw some point in time and value of Box center <.001 & value of Box center >.0001 if ((et(qCntr}cxA(mCntr,nowCntr))<.0015) & ((et(qCntr)cxA(mCntr,nowCntr))> .0001) %put e!emn! of BoxCentr in an array called BoxCenEimts BoxCenEimts(mCntr,rowCntr)=qCntr; % Find the coeffients of the wavelet transform 'total' coeffs(mCntr,rowCntr)=cwt(total(1 ,qCntr),s(rowCntr),'morl'): if (coeffs(mCntr,rowCntr) >= thresh) Decoded_Data(mCntr,nowCntr)=1: else Decoded_Data(mCntr,rowCntr)=O; end mCntr=mCntr+1: end qCntr=qCntr+1: end mCntr1: end %Decoded Data 'Push "OutPut File" to see the decoded data' 51
PAGE 63
% C.fo o/o o/o o/o0/oc/o o/o o/o o/o e/c o/o%% o/o o/o o/c %. o/o 0/o 0/c o/o o/o% %o/o o/o %o/o %o/o %o/>l "/o o/o% o/oCfo'%% '%% o/o% %%%%%%%%%%% % %o/o o/t> o/;, o/oo/o o/o0/o%%0/oo/o. %0/o% o/o %o/;,%o/o%0/o% o/o %o/e%0/o "fcl o/o o/o 0/c% o/.,'%0/;:, o/oo/o%% o/o'%%. o/oo/o% o/:a o/., o/o0/;, %% o/c % o/o% o/o %o/a 0/o o/o %o/o% % % 'svcbac.m' % This function is for the encode data slider values % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 0.4%1 %o/o 0/oo/o o/o 0/o 0/oo/o 0/o o/o% 0/o 0,0 o/:, o/o o/o %0/o o/c0/o o/c o/o o/o o/c0/o %o/o o/o% 0A:. o/o o/oo/o o/o %%o/a%%% o/o o/o%% 0/o o/o% o/.:0/o o/o 0/o o/o o/o o/o% o/o o/o o/oo/o function svcback() % function call Hc_az=findobj(gcf,'Tag','AZslider');% define a slider object Hc_cur=findobj(gcf, 'Tag','AZcur'); % put the current value of the slider obj in He_ cur. str=num2str(get(Hc_az. 'Value')); % convert the number to a string num=get(Hc_az, 'Value'); % put the value of the slider into 'num' set(Hc_cur, 'String',str); % writes the value to the text box lid= fopen('temp1.m','w'); COUNT= fprintf(fid,'%3.31\n' ,num); fclose(fid); %open the temp1.m file % write the value of the slider in the file %close the file. .52
PAGE 64
% o/o0/o o/o% o/o% 0,0% o/o0/o0/o ;o o/oo/o 0/o% o/o% o/o% o/oo/o o/o0/0 /c%. 0/o o/o 0/o %0/oo/o o/o o/o 'Vo o/o0/o%o/ol10o/o o/o o/o% o/o 110% o/o o/o o/o 0/o o/:;, %. %% o/o o/;)% =to% o/o% o/o o/o o/o%% %o/o o/o o/er %o/c o/c:0/c o/o o/o %o/o o/oo/o% %o/oo/o0/c%:J/::. o/oo/o o/o% o_,(.o/o o/o o/oo/::t %o/Q o/o 0/o o/c0/c %%% o/<0 o/o o/o o/o %t o/oo/o %o/o o/o o/:) % % 'svcbac2.m' % This function is for the Threshold data slider values % % o/o% o/o o/o 0/o o/o o/o '%o/o %o/o%% %. 0tCo/::t %G/c o/c 0/o%%% o/o /o o/o o/o0/o o/o o/oo/o o/co/o o/o o/o o/o o/o o/o% o/c%t 0/co/o% %%%%%%%%%%% o/o %o/a% o/o0/o0/:a% %o/o%% o/o %0/o '%%0/c% o/o0/o %o/o 0/o 0/o o/o% %0/o c/c% o/o 0/o 0/o0/oo/o% 0/o o/oo/o 0/oo/o 0t0o/o 0/o o/:.% o/"%%% o/o o/iJo/o o/o% 0/o o/o%% 0/o %t 0/o o/o function svcback2() % function call Hc_az=findobj(gcr,'Tag','BZslider');% define a slider object Hc_curfindobj(gct,'Tag','BZcur'); %put the current value of the slider obj in He_ cur. str=num2str(get(Hc_az, 'Value')); % convert the number to a string num=get(Hc_az. 'Value'); % put the value of the slider into 'num' set(Hc_cur, 'String',str); % wriies the value to the text box lid= fopen('temp2.m','w'); COUNT= fprintf(lid,'%3.31\n',num); fdose(fid); %open the temp1.m file % write the value cf the slider in the file % close the file. 53
PAGE 65
function fig = wguiO % This is the machinegenerated of a Handle Graphics object % and its children. Note that handle values may change when these objects % are recreated. This may cause problems with any callbacks written to % depend on the value of the handle at the time the object was saved. %This problem is solved by saving the output as a FIGfile. %To reopen this object, just type the name of the Miile at the MA TLAB %prompt The Mfrle and its associated MATme must be on your path. %NOTE: certain newer features in MATIAB may not have been saved in this % Mfile due !o limitations of this format, which has been superseded by % FIGfiles. Figures which have been annotated using the plot editor tools %are incompatible with the Mlile/MATfile format. and should be saved as %FIGfiles. loadwgui hO = figure('Color' ,(0.8 0.8 0.8), ... 'Colormap',matO, ... 'FileName','C:\MA TLABR11 lwork\wgui.m', ... 'PaperPosition',(18180 576 432], .oo 'PaperUnits','points', ... 550 420], ... 'Tag, F1g1, ... 'TooiBar','none'); h1 = uicontrolfParent' ,hO, ... 'Units','points', ... 'BackgroundColor',[O. 788235294117647 0. 788235294117647 o. 788235294117647], ... 'FontWeight','bold', ... 'listboxTop',O, ... 'Posltion',[6.75 288 48.75 23.25], ... 'String' ,'Input Parameters', ... 'Style' ,'text' .... 'Tag','StaticText1 '); h1 = uicontroiCParent' ,hO, 000 'Units' ,'points', ... 'BackgroundColor',[O. 788235294117647 0.788235294117647 0.788235294117647), ... 'FontWeight','bold', ... 'ListboxTop',O, 000 'Position',[6.75 215.25 48.75 23.25], 000 'String','Encode Data', oo 'Style' ,'text', ... 'Tag' ,'StaticText1'); h1 = uicontrolfParent' ,hO, ... 'Units','points', ... 'BackgroundColor' ,[0. 78823529411764 7 0. 788235294117647 0.788235294117647), ... 'FontWeight' ,'bold', 000 'ListboxTop',O, ... 'Position',(6.75 84 48.75 23.25], ... 'String','Decode Data', 000 'Style' ,'text', 00. 'Tag','StaticText1'); h1 = uicontroi('Parent',hO, 000 'Units','points', 000 'BackgroundColor',[O.B47058823529412 0.815686274509804 0.784313725490196), 000 'Callback',mat1, ... 'ListboxTop',O, 000 'Position',[8.625 251.25 4515], ... 'String','Graph Data', .. 'Tag','Pushbutton 1 ', .. 'TooltipString','Represent 1 s & Os as Boxes'); h1 = uicontroi('Parent',hO, ... 'Units' ,'points', ... 'BackgroundColor',[O.B47058823529412 0.815686274509804 o. 784313725490196), ... 54
PAGE 66
'Callback','open dataFile.m', ... 'ListbOKTOp',O, ... 'Position',(8.625 269.25 45 15], ... 'String','Data File', .. 'Tag','Pushbutton2', .. 'ToollipString','View, Moclify the input data.'); h1 = uicontroi('Parent' ,hO, ... 'Units','points', ... 'BackgroundColof,[0.847058823529412 0.815686274509804 0. 784313725490196), ... 'Callback' ,'analog', ... 'ListboxTop',O, ... 'Position',(8.625 165 45 15], ... 'String','Piot Morter ... Tag' ,'Pushbutton3' ... 'TooltipString','Piot the Encoclecl Data. Noise is added to the data.'); h1 = uicontrolCParenr ,hO, ... 'Units','points', ... 'BackgroundColor',[0.847058823529412 0.815686274509804 0. 784313725490196), ... 'Callback','decocle', ... 'ListboxTop',O, ... 30.75 4515), ... String Decode, ... 'Tag'.'Pushbutton4', ... 'TooltipString','Retum the Encoded data, along with any noise, to the origional binary data.'); h1 = uicontrol('Parenf,hO, ... 'Units','points', ... 'BackgroundColof,(0.847058823529412 0.815686274509804 0. 784313725490196), ... 'Callback','Pdecode', ... 'ListboxTop',O, ... 'Position',(8.62511.254515], ... 'String','Ouput Data', ... 'Tag','Pushbutton5'); h1 = uicontroi('Parent' ,hO, ... 'Units','points', ... 'Background Color' ,(0.847058823529412 0.815686274509804 0. 784313725490196), ... 'ListboxTop',O, ... 'Position',[O 242.25 63 0.75], ... 'Style','frame', ... 'Tag','Frame2'); h1 = axes('Parent',hO, ... 'Units','pixels', ... 'Box','on', ... 'CameraUpVectof,(O 1 0), ... 'CameraUpVectorMode','manual', ... 'Color',(1 1 1), ... 'Color0rder',mat2, ... 'NextPlof,'add', ... 'Position',(141 37 398 257), ... 'Tag','Axes2', ... o OJ, ... XGnd ,on, ... 'XTici
