0% found this document useful (0 votes)
82 views

Matlab Commands Functions For Signal Processing & Control

This document outlines commonly used Matlab functions for signal processing and control, including FFT, filtering, impulse response, frequency response, convolution, correlation, and simulation of continuous systems. It provides examples of basic Matlab functions and demonstrates how complex commands can be broken down into a sequence of basic operations.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views

Matlab Commands Functions For Signal Processing & Control

This document outlines commonly used Matlab functions for signal processing and control, including FFT, filtering, impulse response, frequency response, convolution, correlation, and simulation of continuous systems. It provides examples of basic Matlab functions and demonstrates how complex commands can be broken down into a sequence of basic operations.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Matlab Commands/Functions for Signal Processing & Control file:///D:/Dropbox/matlab/html/cheat_sheet.

html

Matlab Commands/Functions for Signal Processing &


Control
This document outlines some of the most commonly used matlab functions and features used
in signals and systems (stage 2), digital signal processing (stage 3 and 4) and control (stage 2
-DT021). Note that this document does not deal with plotting data - a separate document
dealing with plotting data is available. A third document will be available which will provide
example code to achieve common tasks such as filtering signals, analysing frequency content
and designing filters/systems.

Contents

Commonly Used General Purpose Matlab Functions


Commonly Used Signal Processing & Control Theory Functions
When Matlab Commands Start to Look Complicated (but they aren't really)

Commonly Used General Purpose Matlab Functions

The following is a list of functions that are used very frequently

round - rounds a sequence of numbers to the nearest integer


abs - detemines the magnitudes of a sequence of complex numbers
angle - detemines the angle (or phase) of a sequence of numbers
rand - generate a sequence of random numbers e.g. x = rand(1, 10)
zeros - generate a sequence of zeros e.g. x = rand(1, 500)
ones - generate a sequence of ones e.g. x = rand(1, 99)
max - determine the maximum value in a sequence of numbers. e.g. x = [1 8 4];
max_val = max(x); %max_val will be 8. e.g. 2 x = [1 8 4]; [max_val
location] = max(x); % max_val will be 8 and location will be 2 i.e. the second
sample
min - similar usage as max but dermines the minimum of a sequence of numbers
size - determines the number of rows and colums in a sequence of numbers (matrix)
e.g. x = rand(2,3); [num_rows num_columns] = size(x); % num_rows will be 2
and num_columns will be 3
length - same as max(size(x)); i.e. determines the maximum of the number of rows
or columns in a sequence of numbers.

Commonly Used Signal Processing & Control Theory Functions

The following functions are vital in order to develop an understanding of Signal Processing
and Control Theory

fft - determine the frequency content of a sequence of numbers e.g. X = fft(x);


filter - determine the output y of a system/filter (system defined by b and a
coefficients) given and input x e.g. |y = filter(b,a,x); |
impz - determine the impulse response of a digital system defined by b and a
coefficients e.g. h = impz(b, a);
freqz - determine the frequency response of a digital system defined by b and a
coefficients. H = freqz(b, a);
conv - determine the ouput y of a digital system/filter to an input x given the impulse
response h e.g. y = conv(x,h);
xcorr - cross correlate (measure similarity between) two sequences of numbers. e.g.
corr_values = xcorr(u, v);
step - determine the step response of a continuous system. r = step(b,a)
impulse - determine the impulse response of a continuous system h = impulse(b,a)

1 of 2 30/01/2012 12:22
Matlab Commands/Functions for Signal Processing & Control file:///D:/Dropbox/matlab/html/cheat_sheet.html

lsim - determine the (simulated) output of a continuous system described by b and a


coefficients to an input with amplitudes in the variable u defined at times in given in t
e.g. y = lsim(b, a, u, t)

When Matlab Commands Start to Look Complicated (but they aren't really)

Here is an example of how to plot a random signal with 1000 sample values between 30 and
40 which have been rounded to the nearest integer.

x = rand(1, 1000); %creates a 1000 values between 0 and 1


x = x*10; % x is now a sequence of numbers between 0 and 10
x = x+30; % x is now a sequence of numbers between 30 and 40
x = round(x);
plot(x);

Most students could make sense of the above code with little or no assistance. However if
they were presented with the following code (which does the same as above in one line) they
might have some difficulty when starting to get comfortable with Matlab.
plot(round((rand(1,1000)*10)+30));

One of the biggest challanges for students new to matlab is to recognise that such commands
are simply a sequence of basic commands.

Published with MATLAB® 7.11

2 of 2 30/01/2012 12:22

You might also like