%Example 2.7 produce Figure 2.19 
%

%Plant (2.54):  G(s)=200/(10s+1)(0.005s+1)^2,  Gd(s)=100/(10s+1)
Eq2_54

% Controller for command following (which inverts the plant)

wc0=10;
c0 = nd2sys([10 1],[200 1.e-3],wc0); cf= nd2sys([0.1 1],[0.01 1]); 
c0 = mmult(c0,cf);
c=c0;
l = mmult(g,c); l0=l;
s = minv(madd(1,l));
sgd = mmult(s,gd);
y0 = trsp(sgd,1,3);
t=msub(1,s); y0r=trsp(t,1,3); % rise time 0.16s, no overshoot

figure(1);
subplot(221),vplot(y0r,1,'w:')
axis([0,3,-0.2,1.5]);
xlabel('Time');ylabel('y');
title('TRACKING RESPONSE');
subplot(222),vplot(y0,0,'w:')
axis([0,3,-0.2,1.5]);
xlabel('Time');ylabel('y');
title('DISTURBANCE RESPONSE');
