From: Ahmad on
Hi,

Following is my code for plotting the continuous closed loop poles and equivlent discrete closed loop poles for different values of R matrix.

A = [0 1;0 0];
B = [0;1];
C = [1 0];
D = [0];
Ts = 0.4;
states = {'theta','dtheta'};
inputs = {'F'};
outputs = {'theta'};
sysC = ss(A,B,C,D,'statename',states,'inputname',inputs,'outputname',outputs);
sysD = c2d(sysC,Ts,'zoh')
R = [10000 1 0.5 0.2 0.1 0.05 0.02 0.01];
Ws_Wn = [9 8 7 6 5 4 3 2];
Q = [1 0;0 0];
hold on
for i=1:length(R)
[K S e] = lqr(sysC,Q,R(i));
plot(e,'r.');
[K S e] = lqrd(sysC.a,sysC.b,Q,R(i),Ws_Wn(i));
plot(e,'b.');
end
hold off
sgrid

What I want to plot is the equivalent s-plane roots of these digital controllers but i dont know how to convert to s-planes roots of the digital controller and plot on the same figure?

Regards
From: Ahmad on
Well I got it by my self. Here is the solution

A = [0 1;0 0];
B = [0;1];
C = [1 0];
D = [0];
Ts = 0.4;
states = {'theta','dtheta'};
inputs = {'F'};
outputs = {'theta'};
sysC = ss(A,B,C,D,'statename',states,'inputname',inputs,'outputname',outputs);
sysD = c2d(sysC,Ts,'zoh')
R = [10000 1 0.5 0.2 0.1 0.05 0.02 0.01];
T = 1;
Q = [1 0;0 0];
hold on
for i=1:length(R)
[K S e] = lqr(sysC,Q,R(i));
plot(e,'r.');
[K S e] = lqrd(sysC.a,sysC.b,Q,R(i),T);
plot(log(e)/T,'b.');
end
hold off
sgrid