%Figure 5.7
omega=logspace(-2,2,41);
t = nd2sys([-1 1],[1 1], 1);
t_g=frsp(t,omega);
S_g = msub(1,t_g);

subplot(211),vplot('liv,lm',S_g,1,':')
%axis([.01,100,.01,10]);
text(0.42,0.02,'z/2');
xlabel('Frequency * (1/z)');ylabel('|S|');
title('(a)');
% Plot of the ideal S for plant with complex RHP-zeros, x +- jy.
% Let R = y/x
omega=logspace(-2,2,81);
R= 0.1;s1=frsp(msub(1,nd2sys([1 -2 1+R^2],[1  2 1+R^2])),omega);
R= 1;  s2=frsp(msub(1,nd2sys([1 -2 1+R^2],[1  2 1+R^2])),omega);
R=10;  s3=frsp(msub(1,nd2sys([1 -2 1+R^2],[1  2 1+R^2])),omega);
R=50;  s4=frsp(msub(1,nd2sys([1 -2 1+R^2],[1  2 1+R^2])),omega);

subplot(212),vplot('liv,lm',s1,s2,s3,s4,1,'w:')
axis([.01,100,.01,5]);
text(6,0.05,'y/x =  50')
text(0.3,0.05,'y/x =  10')
text(0.3,0.5,'y/x =  1')
text(0.15,2,'y/x =  0.1')
xlabel('Frequency * (1/x)');ylabel('|S|');
title('(b)');


