%  limitations_rhppzdel.m
%Limitations due to RHP pole and zero and RHP pole and time delay
%   kja 070930

aminit;					% initialize MATALB
clf;

w=logspace(-2,2);
s=i*w;
%
%   Pole and zero in the RHP zero faster than pole
b=1;
for a=[2 5 10 20 50],
%for a=[2 6 10 20 50],   
Ppz=(a-s).*(s+b)./(a+s)./(s-b);
subplot(321)
pl=semilogx(w,-180*angle(Ppz)/pi);hold on;
set(gca,'Ytick',[0 90 180])
set(pl,'Linewidth',AM_bode_linewidth)
%axis([0.01 100 0 180]);
xlabel('w');ylabel('p')
end
%   Pole and zero in the RHP zero slower than pole
for a=[1/2 1/5 1/10 1/20 1/50];
Ppz=(a-s).*(s+b)./(a+s)./(s-b);
subplot(321)
pl=semilogx(w,180*angle(Ppz)/pi,'b--');hold on;
set(gca,'Ytick',[0 90 180])
set(pl,'Linewidth',AM_bode_linewidth)
%axis([0.01 100 0 180]);
xlabel('w');ylabel('p')
end
line([0.01 100],[90 90]);
amprint('limitations-rhppz.eps');
clf
%
%   Pole in the RHP and time delay
b=1;
for T=[0.05 0.1 0.2 0.5 1]
%for T=[0.05 0.1 0.3 0.5 1]    
Ppz=(s+b).*exp(-s*T)./(s-b);
subplot(321)
pl=semilogx(w,-180*unwrap(angle(Ppz))/pi);hold on;
set(gca,'Ytick',[0 90 180])
set(pl,'Linewidth',AM_bode_linewidth)
axis([0.01 100 0 180]);
xlabel('w');ylabel('p')
end
line([0.01 100],[90 90]);
amprint('limitations-rhpdel.eps');
