Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
1059 kaklik 1
%% ukol 9
2
%% pr 1
3
clc, clear;
4
A = [-0.01 0;0 -0.02];
5
B=[1 1;-0.25 0.75];
6
C1 = [1 0];
7
C2 = [0 1];
8
D = 0;
9
F1 = [-1.1 -3.7;0 0];
10
F2=[0 0;-1.1 1.233];
11
F3=[-0.1 0;0 -0.1];
12
 
13
sys11 = ss(A+B*F1,B,C1,D);
14
sys21 = ss(A+B*F2,B,C1,D);
15
sys31 = ss(A+B*F3,B,C1,D);
16
sys12 = ss(A+B*F1,B,C2,D);
17
sys22 = ss(A+B*F2,B,C2,D);
18
sys32 = ss(A+B*F3,B,C2,D);
19
 
20
subplot(211)
21
hold on
22
initial(sys11,'b',[0;1]);
23
initial(sys21,'r',[0;1]);
24
initial(sys31,'k',[0;1]);
25
xlabel('time');
26
ylabel('x_1');
27
grid on;
28
legend('F1','F2','F3');
29
 
30
subplot(212),hold on;
31
initial(sys12,'b',[0;1]);
32
initial(sys22,'r',[0;1]);
33
initial(sys32,'k',[0;1]);
34
xlabel('time');
35
ylabel('x_2');
36
legend('F1','F2','F3'),grid on;
37
%% pr 2
38
clc,clear;
39
A = [0 1 0 0;0 0 1 0;0 0 0 1;1 1 -3 4]
40
B = [1 0;1 0;1 0;0 1]
41
B1 = [1 1 1 0]'
42
B2 = [0 0 0 1]'
43
Con = ctrb(A,B)
44
rank(Con)
45
Con1 = ctrb(A,B1)
46
rank(Con1)
47
Con2 = ctrb(A,B2)
48
rank(Con2)
49
ad = ((s+1+i)*(s+1-i)*(s+2+i)*(s+2-i))
50
syms a b c d
51
Fc = [a b c d]
52
ac = det(sym(s*eye(4))-(A+B2*Fc))
53
F = [0 0 0 0;-11 -19 -12 -10]
54
Fj=[0 0 0 0;-11 -29 -22 -20]
55
Bj = [0 0;0 0;0 0;0 1]
56
roots(det((s*eye(4))-(A+B*Fj)))
57
%% pr 3
58
clc, clear;
59
A = [0 1;1 0]
60
B = [1;0]
61
Q = [1 0;0 0]
62
R = 1
63
syms a b c
64
Pc = [a b;b c]
65
rica = A'*Pc+Pc*A-Pc*B*inv(R)*B'*Pc+Q
66
[x y z]=solve('2*b-a^2+1=0','a+c-a*b=0','2*b-b^2=0')
67
Pcc = [x(3),y(3);y(3) z(3)]
68
u = -inv(R)*B'*Pcc
69
%% pr 4
70
clc,clear;
71
A = [0 1;0 0]
72
B = [0;1]
73
C = [1 0]
74
D = 1
75
syms a b
76
F = [a b]
77
Af = A+B*F
78
Cf = C+D*F
79
O = [Cf;Cf*Af]
80
Ff = [-1 0]
81
Aff = A+B*Ff
82
Cff = C+D*Ff
83
Hf=Cff*(sym(s*eye(2))-Aff)^-1*B+D
84
%% pr 5
85
clc,clear;
86
A = [0 1;0 -1]
87
B = [0;1]
88
Con = ctrb(A,B)
89
rank(Con)