-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlab_07.m
More file actions
43 lines (35 loc) · 912 Bytes
/
Copy pathlab_07.m
File metadata and controls
43 lines (35 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
close all;
clear all;
clc;
s = tf('s');
t = 0:0.001:15;
%=========================== LAB 01 ===============================
P_a = (s^2+4*s+8)/(s^2*(s+4));
G_a= P_a;
H = 1;
k_a = 7.57;
G_2 = P_a * k_a;
T_a = feedback(G_2, H);
pole(T_a)
figure, rlocus(P_a*H)
%=========================== LAB 02 ===============================
P = (5)/(s*(s+3));
K = 2.97*((s+2)/(s+2.85));
G = P*K;
T = feedback(G, H); %com controlador
T_2 = feedback(P, H); %sem controlador
pole(T)
y1 = step(T, t); %com controlador
y2 = step(T_2, t); %sem controlador
figure, plot(t, y1, '-b', t, y2, 'r');
legend('com controlador', 'sem controlador')
xlabel('Tempo (s)');
ylabel('Amplitude (S.I.');
title('Resposta ao degrau');
F = (K)/(1+K*P*H);
y3 = step(F, t);
figure, plot(t, y3, '-g');
legend('sinal de controle')
xlabel('Tempo (s)');
ylabel('Amplitude (S.I.');
title('Resposta ao degrau');