%Figure 2.2
num=5;den=[10 1];delay=2;        %G(s)=exp(-delay*s)*num/den
w=logspace(-3,1,41)';
[mag,pha]=bode(num,den,w);
pha=pha-delay*w*180/pi;          %Phase in [degree]
[gm,pm,wcg,wcp]=margin(num,den); %Wc
clf
subplot(211),loglog(w,mag,w,w./w,':',[wcp wcp],[0.01 1],':')
ylabel('Magnitude of g(s)')
xlabel('Frequency')

subplot(212), semilogx(w,pha)
ylabel('Phase of g(s)')
xlabel('Frequency')
axis([.001,10,-300,0])
