Você está na página 1de 3

Introduo ao MATLAB: MATrix LABoratory

Linguagem de programao interativa;


Ferramenta poderosa, flexvel e eficiente;
As Funes manipulam matrizes como um todo;
Gera cdigos compactos e eficientes; e
Trata sistemas crticos com grande exigncia de capacidade numrica
computacional.

WORKSPACE: >> prompt

>> t=1
>> tt=2;
>> T=[0 1 2 3 4 5 6 7 8 9 10];
>> TT=0:1:10;
>> T(3)
>> ans=2
>> pi
>> ans=3.14159
>> format short
>> format long
>> help sin
>> zeros(3,2)
>> eye(3)
>> ones(3,5)
>> who
>> whos
>> clear


EXERCCIO: Obter
1) Fun. de Transf. dada pela Eq. Dif.:
) ( 2 t x y
dt
dy
= +
; c.i. nulas:
2
1
) (
) (
+
=
s s X
s Y

2) Resposta: y(t) , para a Entrada dada pela F. DEGRAU Unitrio.
Usando o MEFP e Transf. Laplace Inversa:
t
e t y
2
2
1
2
1
) (

=

3) Exerccio: SIMULAR !


>> t=0:0.1:10;
>> y=0.5-0.5*exp(-2*t);
>> plot(t,y)
>> xlabel('Tempo [seg]')
>> ylabel('Resposta y(t)')



0 2 4 6 8
-0.1
0
0.1
0.2
0.3
0.4
0.5
Tempo [seg]
R
e
s
p
o
s
t
a

y
(
t
)


4) FUNO de TRANSFERNCIA vs. MATLAB:
>> num=[1]; >> den=[1 2]; >> step(num,den); % TL=1/s

2
EXERCCIO: Dada
0 2 3 = + + y y y
;
a y = ) 0 (
;
b y =

1) Funo de Transferncia:
) 2 )( 1 (
) 3 (
2 3
) 3 (
) (
2
+ +
+ +
=
+ +
+ +
=
s s
a b as
s s
a b as
s Y

2) Segundo o MEFP:
2 1
2
) (
+
+

+
+
=
s
b a
s
b a
s Y

3) A Resposta:
t t
e b a e b a t y
2
) ( ) 2 ( ) (

+ + =
; 0 t
4) SIMULAR: Para: a=0.1 ; b=10 ;

>> t=0:0.1:15;
>> y=(2*.1+10)*exp(-t)-(.1+10)*exp(-2*t);
>> plot(t,y)
>> grid
>> xlabel('Segundos')
>> ylabel('Resposta y(t)')

0 5 10 15
-0.5
0
0.5
1
1.5
2
2.5
3
Segundos
R
e
s
p
o
s
t
a

y
(
t
)


5) FUNO de TRANSFERNCIA vs. MATLAB:

>> num=[0.1 10.3]; >> den=[1 3 2]; >> impulse(num,den)


EXERCCIO: Sistema de suspenso:
0 ) ( ) ( = + + x y k x y b y m
; c.i. nulas
1) Fun. de Transf.:
k bs ms
k bs
s X
s Y
+ +
+
=
2
) (
) (

2) A Resposta: y(t) , usando Matlab:
3) SIMULAR esta funo: Para b=1 ; k=10 ; m=5

>> num=[1 10];
>> den=[5 1 10];
>> impulse(num,den)
>> R= roots(den)
R = -0.1000 + 1.4107i
-0.1000 - 1.4107i
>> P=poly(R)
P = 1.0 0.20 2.0
0 10 20 30 40 50 60
-1.5
-1
-0.5
0
0.5
1
1.5
Impulse Response
Time (sec)
A
m
p
l
i
t
u
d
e


3


EXERCCIO: Obter
1) Trans. Inv. De Laplace pelo MEFP (Caso 1):
) 3 )( 1 (
2
) (
+ +
+
=
s s s
s
s F

2) Resposta: f(t) , usando MATLAB:

>> R=[0 -1 -3];
>> poly(R)
ans = 1 4 3 0

>> num=[1 2];
>> den=[1 4 3 0];
>> impulse(num,den)


0 1 2 3 4 5 6 7 8 9 10
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
Impulse Response
Time (sec)
A
m
p
l
it
u
d
e



1) Trans. Inv. De Laplace pelo MEFP (Caso 2):
) 3 ( ) 2 (
1
) (
3
+ +
=
s s
s F

2) Resposta: f(t) , usando MATLAB:


>> R=[2 2 2 3];
>> poly(R)
ans = 1 9 30 44 24
>> num=[1];
>> den=[1 9 30 44 24];
>> impulse(num,den)
>> step(num,den)
0 1 2 3 4 5 6 7 8 9
0
0.005
0.01
0.015
0.02
0.025
Impulse Response
Time (sec)
A
m
p
l
i
t
u
d
e



0 1 2 3 4 5 6 7 8 9
0
0.01
0.02
0.03
0.04
0.05
Step Response
Time (sec)
A
m
p
l
i
t
u
d
e

Você também pode gostar