Académique Documents
Professionnel Documents
Culture Documents
Maths
and Computation
development
Data acquisition
Modeling, simulation and prototyping
Scientific and engineering graphics
Data analysis, exploration and
virtualization
Application development, including
graphical user interface building
To MATLAB
Algorithms
MATLAB WINDOWS
2:23 PM
MATrix LABoratory
powerful high-level programming language for
scientific computations.
supports a rich suite of mathematical, statistical and
engineering functions.
functionality is extended with interactive graphical
capabilities for creating 2D as well as 3D plots.
provides comprehensive toolboxes.
Areas in which toolboxes are available include
communications, signal processing, control systems, neural
networks, fuzzy logic, simulation and many more.
MATLAB WINDOWS
GETTING STARTED
2:23 PM
Entering Matrices
A=[1 2 3 4]
Or
A=[1,2,3,4]
Workspace
Row Matrices
Column Matrices
Other matrices.
C=
B=[1;2;3;4]
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
1/16/2016
TRANSPOSE
C=
C generates
1
2
3
4
5 9 13
6 10 14
7 11 15
8 12 16
9 10
13 14
11 12
15 16
Magic(5)
diary lab#02
diary off
format long
format short
format compact
format loose
COLON(:)
OPERATORS
+
*
/
^
()
Addition
Subtraction
Multiplication
Division
Power
Complex conjugate transpose
Specify evaluation order
1/16/2016
LAB SESSION 1
Objective
Mean
Median
SIGNALS REPRESENTATION
Examples:
Two functions
plot
stem
Step size
2:23 PM
2:23 PM
PLOTTING IN MATLAB
for CT signals
for DT signals
15
16
EXAMPLES
EXAMPLES
title(Example Sinusoid)
xlabel(time(sec))
ylabel(Amplitude)
2:23 PM
2:23 PM
t = [-2:0.002:2]
how to generate vector x?
x = 10 * sin (pi * t)
plot(t, x)
Vector on x-axis
Vector on y-axis
17
18
1/16/2016
MULTIPLE PLOTS
GENERATING SUBPLOTS
subplot(2, 3, 2)
19
EXAMPLE
2:23 PM
2:23 PM
20
DT PLOTS
Plot the DT sequences:
x = {2, 3, -1, 5, 4, 2, 3, 4, 6, 1}
2:23 PM
2:23 PM
x = [2, 3, -1, 5, 4, 2, 3, 4, 6, 1]
n = -6:3;
stem(n, x);
21
22
24
zeros(1, 5)
[0 0 0 0 0]
ones(1, 5)
[1 1 1 1 1]
2:23 PM
2:23 PM
25
1/16/2016
UNIT IMPULSE
n = -5:5;
stem(n, [zeros(1, 5) 1 zeros(1, 5)]);
2:23 PM
2:23 PM
EXERCISE
n = -10:10;
x1 = 10 * cos(pi * n);
x2 = 5 * cos(0.25 * pi * n);
x = x1 .* x2;
stem(n, x);
26
27