Subversion Repositories svnkaklik

Rev

Blame | Last modification | View Log | Download

%% ukol 9
%% pr 1
clc, clear;
A = [-0.01 0;0 -0.02];
B=[1 1;-0.25 0.75];
C1 = [1 0];
C2 = [0 1];
D = 0;
F1 = [-1.1 -3.7;0 0];
F2=[0 0;-1.1 1.233];
F3=[-0.1 0;0 -0.1];

sys11 = ss(A+B*F1,B,C1,D);
sys21 = ss(A+B*F2,B,C1,D);
sys31 = ss(A+B*F3,B,C1,D);
sys12 = ss(A+B*F1,B,C2,D);
sys22 = ss(A+B*F2,B,C2,D);
sys32 = ss(A+B*F3,B,C2,D);

subplot(211)
hold on
initial(sys11,'b',[0;1]);
initial(sys21,'r',[0;1]);
initial(sys31,'k',[0;1]);
xlabel('time');
ylabel('x_1');
grid on;
legend('F1','F2','F3');

subplot(212),hold on;
initial(sys12,'b',[0;1]);
initial(sys22,'r',[0;1]);
initial(sys32,'k',[0;1]);
xlabel('time');
ylabel('x_2');
legend('F1','F2','F3'),grid on;
%% pr 2
clc,clear;
A = [0 1 0 0;0 0 1 0;0 0 0 1;1 1 -3 4]
B = [1 0;1 0;1 0;0 1]
B1 = [1 1 1 0]'
B2 = [0 0 0 1]'
Con = ctrb(A,B)
rank(Con)
Con1 = ctrb(A,B1)
rank(Con1)
Con2 = ctrb(A,B2)
rank(Con2)
ad = ((s+1+i)*(s+1-i)*(s+2+i)*(s+2-i))
syms a b c d
Fc = [a b c d]
ac = det(sym(s*eye(4))-(A+B2*Fc))
F = [0 0 0 0;-11 -19 -12 -10]
Fj=[0 0 0 0;-11 -29 -22 -20]
Bj = [0 0;0 0;0 0;0 1]
roots(det((s*eye(4))-(A+B*Fj)))
%% pr 3
clc, clear;
A = [0 1;1 0]
B = [1;0]
Q = [1 0;0 0]
R = 1
syms a b c
Pc = [a b;b c]
rica = A'*Pc+Pc*A-Pc*B*inv(R)*B'*Pc+Q
[x y z]=solve('2*b-a^2+1=0','a+c-a*b=0','2*b-b^2=0')
Pcc = [x(3),y(3);y(3) z(3)]
u = -inv(R)*B'*Pcc
%% pr 4
clc,clear;
A = [0 1;0 0]
B = [0;1]
C = [1 0]
D = 1
syms a b
F = [a b]
Af = A+B*F
Cf = C+D*F
O = [Cf;Cf*Af]
Ff = [-1 0]
Aff = A+B*Ff
Cff = C+D*Ff
Hf=Cff*(sym(s*eye(2))-Aff)^-1*B+D
%% pr 5
clc,clear;
A = [0 1;0 -1]
B = [0;1]
Con = ctrb(A,B)
rank(Con)