0% found this document useful (0 votes)
128 views2 pages

Wavelet Step by Step

This document discusses loading and plotting a signal file called "PieceRegSig" in MATLAB. It explains how to use the "load" command to import the signal data from the file into a vector variable called "sig". It then shows how to use the "plot" command to display the signal, which features both integer and non-integer singularities. It also introduces MATLAB structures, demonstrating how to assign the signal data to the "s" field and start time to the "d" field of a structure variable called "sig" to represent the structured signal.

Uploaded by

azizcr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
128 views2 pages

Wavelet Step by Step

This document discusses loading and plotting a signal file called "PieceRegSig" in MATLAB. It explains how to use the "load" command to import the signal data from the file into a vector variable called "sig". It then shows how to use the "plot" command to display the signal, which features both integer and non-integer singularities. It also introduces MATLAB structures, demonstrating how to assign the signal data to the "s" field and start time to the "d" field of a structure variable called "sig" to represent the structured signal.

Uploaded by

azizcr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Fetch and display a signal

This tutorial is on signal processing with wavelets, so we will need a signal to work on. First you need
to download the signal to your Matlab working folder. It is a numerical file in Matlab format.
Then do a "clear all" command if you have worked previously in Matlab.
To load the signal file into the Matlab workspace, use the load command (see "help load") for the file
name of the downloaded Matlab file, which is "PieceRegSig". This will create a vector variable named
"sig" into the workspace, with length 1024 (wavelets love powers of 2).
Now we want to plot the signal. To do so, use the "plot" function.
You should understand why the file is called PieceRegSig, the signal is indeed a piecewise regular signal,
with isolated singularities. Wavelets are good at handling such signals.
To load the file, type
>> load PieceRegSig
and return into the command window. If this does not work, make sure that the file is in the Matlab work
folder. If you are familiar with Matlab, you can also fix the path of Matlab in order to include your
download directory. You should now see a variable named sig in the workspace pane of Matlab, with
length 1024. To plot the signal, enter the plot function under its command syntax in the command
window:
>> plot(sig)
The result should look like this:

This function is taken from Stphane Mallat's book and can be recreated using the Wavelab toolbox for
Matlab. It features not only singularities with integer order (like jumps), but also non integer Lipschitz
singularities, i.e., the Lipschitz regularity drops pointwise to a non integer number. The definition of
Lipschitz regularity is here.

Matlab structures

Structures are variables which contain heterogenous data. This data can be accessed by using the
syntax variable.fieldName, wherevariable is the name of the structure, and fieldName is the name
that has been given for the particular chunk of data you want to access. The list of the fields in a
structured variables can be retrieved by calling fieldnames(variable).

Structured signal

To transform the variable sig (that you should have in your workspace as a vector), you assign it to a
variable with a field named s (s for signal).
>> sig.s = sig
to which Matlab should answer with
sig =

s: [1x1024 double]
Note: if you do not want Matlab command lines to produce output on the screen, just put a semi-colon
after you command. For instance
>> sig.s = sig;
does not produce any screen output.

For signals, we use a second field named "d" to store the time (represented as an integer index) at which
the signal starts. This will be useful when we shall implement convolution of signals with general filter
impulse responses. Since we have no information on the beginning index for sig, we shall assign it the
value zero:
>> sig.d = 0
which produces the following output in the command window:
sig =

s: [1x1024 double]
d: 0

Let us do a little sanity check by using the fieldnames function:
>> fieldnames(sig)
produces the output
ans =

's'
'd'
which is a list of strings.

You might also like