Sei sulla pagina 1di 20

Introduction to

Carlos Fuentes Silva


Doctorado en Ingeniera
Automatizacin y Control
Automtico
carlos.fuentes@upq.mx

Introduction
MATLAB
is
both
computer
programming language and software
environment for using that language
effectively.
MATLAB is matrix-oriented, so what
would take several statements in C or
Fortran can usually be accomplished in
just a few lines using MATLAB's built-in
matrix and vector operations

Introduction
MATLAB, which stands for MATrix
LABoratory, is a powerful, generalpurpose system or environment for doing
mathematics, scientific and engineering
calculations.

What is Matlab?
Matlab is basically a high level
language
which
has
many
specialized toolboxes for making
things easier for us
Matlab

How high?

High Level
Languages such as
C, Pascal etc.

Assembly

Matlab Screen
Current Directory
View folders and m-files
Command Window
type commands
Workspace
View program variables
Double click on a variable
to see it in the Array Editor
Command History
view past commands
save a whole session
using diary

TOOLBOX
MATLAB has a number of add-on
software modules, called toolbox , that
perform more specialized computations.
Signal & Image Processing
Signal ProcessingImage Processing Communications
-System Identification - Wavelet
Filter Design

Control Design
Control System - Fuzzy LogicRobust Control-Analysis and SynthesisLMI Control Model Predictive Control
Model-Based Calibration
More than 60 toolboxes
Demonstrations are invaluable since
they give an indication of the MATLAB
capabilities.
A comprehensive set are available by
typing the command >>demo in MATLAB

HELP

Command Line Help:


Help and information on MATLAB can
be found in several ways, from the
command line by using the 'help' topic
command,

from

the

separate

Help

window found under the Help menu, from


the MATLAB helpdesk.

HELP

Variables
No need for types. i.e.,
All variables are created with double
precision unless specified and they are
matrices.
int a;
double b;
float c;

After these statements, the variables are


1x1 matrices with double precision
Example:
>>x=5;
>>x1=2;

Array, Matrix
a vector x = [1 2 5 1]
x =

a matrix M = [1 2 3; 5 1 4; 3 2 -1]
M =

1
5
3

transpose y = x

2
1
2

3
4
-1
y = 1
2
5
1

Array, Matrix
t =1:10
t=

1 2 3 4 5 6 7 8 9 10

k =2:-0.5:-1
k=

2 1.5 1 0.5 0 -0.5 -1

B = [1:4; 5:8]
B=

Generating Vectors from


functions
zeros(M,N)MxN matrix of zeros
x = zeros(2,3)
x = 0
0

0
0

0
0

Matrix Index
The matrix indices begin from 1 (not 0
as in C)
The matrix indices must be positive
integer

A(-2), A(0) Error: ??? Subscript indices


must either be real positive integers.
A(4,2) Error: ??? Index exceeds matrix
dimensions.

Concatenation of Matrices
x = [1 2]

y = [4 5]

A = [ x y]
B = [x ; y]

z=[ 0 0]

1 2 4 5
12
45

C = [x y ;z]
Error: ??? Error using ==> vertcat CAT
arguments dimensions are not
consistent.

PRACTICE

Referencias
http://
www.mathworks.com/products/matlab
/examples.html
Bsqueda google : matlab tutorial

Esta pica
aventura
continua en:

GRACIAS

Carlos Fuentes
Certified LabVIEW
SilvaAssociate

Developer
Certified SOLIDWORKS Associate

Preguntas?

Potrebbero piacerti anche