Introduction to Signal Processing

This numerical tour explores some basic signal processing tasks.

Contents

Installing toolboxes and setting up the path.

You need to download the following files: signal toolbox and general toolbox.

You need to unzip these toolboxes in your working directory, so that you have toolbox_signal and toolbox_general in your directory.

For Scilab user: you must replace the Matlab comment '%' by its Scilab counterpart '//'.

Recommandation: You should create a text file named for instance numericaltour.sce (in Scilab) or numericaltour.m (in Matlab) to write all the Scilab/Matlab command you want to execute. Then, simply run exec('numericaltour.sce'); (in Scilab) or numericaltour; (in Matlab) to run the commands.

Execute this line only if you are using Matlab.

getd = @(p)path(p,path); % scilab users must *not* execute this

Then you can add the toolboxes to the path.

getd('toolbox_signal/');
getd('toolbox_general/');

Loading and Displaying Signals

Signals are 1D vectors, usually stored as (n,1) arrays, where n is the number of samples.

n = 512;

Load a signal. (function load_signal.m should be in the toolbox of each course)

f = load_signal('Piece-Regular', n); % signal of size n

One can force to be a column vector (just to be sure).

f = f(:);

One can rescale to [0,1] the entries of the signal.

f = rescale(f);

Display the signal.

clf;
plot(1:n, f);
axis('tight');
title('My title'); % title
set_label('variable x', 'variable y'); % axis
ans =

     1     4

You can display several figures using subplot

% divide the screen in 2x2 and select 1st quadrant
subplot(2, 2, 1);
plot(f); axis('tight');
% select the last quadrant
subplot(2, 2, 4);
plot(f.^2); axis('tight');
ans =

     1


ans =

     1     3

You can display several signals on the same figure

clf;
plot(1:n, [f f.^2]');
legend('signal', 'signal^2');