s=tf('s');
A=[0 1;-2 -2];
B=[0;1];
C=[1 1];
K=place(A,B,[-4,-25]);
L=place(A',C',[-100,-125])';
Gp=minreal(C*(s.*eye(2)-A)^(-1)*B);
[b,a]=ss2tf(A,B,C,0);
Gp=tf(b,a)
Ah = A-B*K-L*C;
Gc=minreal(-K*minreal((s.*eye(2)-Ah)^(-1))*L);
[b,a]=ss2tf(Ah,L,-K,0);
Gc=tf(b,a)
Gr=minreal(-K*(s.*eye(2)-Ah)^(-1)*B);
pole(Gr);
[b,a]=ss2tf(Ah,B,-K,1);
Gr=tf(b,a)
nyquist(-Gp*Gc)
pole(Gp)
pole(Gc)
pole(1/(1-Gp*Gc))
Af = vertcat(horzcat(A-B*K,-B*K),horzcat(zeros(2,2),A-L*C));
Bf = vertcat(B,zeros(2,1));
Cf = horzcat(C,zeros(1,2));
[b,a] = ss2tf(Af,Bf,Cf,0);
R2Y = tf(b,a);
pole(R2Y)
dcgain(R2Y)