Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
1058 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
plot(initial(sys11,'b',[0;1]), initial(sys21,'r',[0;1]), initial(sys31,'k',[0;1]));
21
 
22
xlabel('time'), ylabel('x_1'), grid on, legend('F1','F2','F3');
23
 
24
plot(initial(sys12,'b',[0;1]), initial(sys22,'r',[0;1]), initial(sys32,'k',[0;1]));
25
xlabel('time');
26
ylabel('x_2');
27
legend('F1','F2','F3'),grid on;
28
 
29
 
30
%% pr 2
31
clc,clear;
32
A = [0 1 0 0;0 0 1 0;0 0 0 1;1 1 -3 4]
33
B = [1 0;1 0;1 0;0 1]
34
B1 = [1 1 1 0]'
35
B2 = [0 0 0 1]'
36
Con = ctrb(A,B)
37
rank(Con)
38
Con1 = ctrb(A,B1)
39
rank(Con1)
40
Con2 = ctrb(A,B2)
41
rank(Con2)
42
ad = ((s+1+i)*(s+1-i)*(s+2+i)*(s+2-i))
43
syms a b c d
44
Fc = [a b c d]
45
ac = det(sym(s*eye(4))-(A+B2*Fc))
46
F = [0 0 0 0;-11 -19 -12 -10]
47
Fj=[0 0 0 0;-11 -29 -22 -20]
48
Bj = [0 0;0 0;0 0;0 1]
49
roots(det((s*eye(4))-(A+B*Fj)))
50
%% pr 3
51
clc, clear;
52
A = [0 1;1 0]
53
B = [1;0]
54
Q = [1 0;0 0]
55
R = 1
56
syms a b c
57
Pc = [a b;b c]
58
rica = A'*Pc+Pc*A-Pc*B*inv(R)*B'*Pc+Q
59
[x y z]=solve('2*b-a^2+1=0','a+c-a*b=0','2*b-b^2=0')
60
Pcc = [x(3),y(3);y(3) z(3)]
61
u = -inv(R)*B'*Pcc
62
%% pr 4
63
clc,clear;
64
A = [0 1;0 0]
65
B = [0;1]
66
C = [1 0]
67
D = 1
68
syms a b
69
F = [a b]
70
Af = A+B*F
71
Cf = C+D*F
72
O = [Cf;Cf*Af]
73
Ff = [-1 0]
74
Aff = A+B*Ff
75
Cff = C+D*Ff
76
Hf=Cff*(sym(s*eye(2))-Aff)^-1*B+D
77
%% pr 5
78
clc,clear;
79
A = [0 1;0 -1]
80
B = [0;1]
81
Con = ctrb(A,B)
82
rank(Con)