% Fig. 6.9   Feedback Control of Dynamic Systems, 8e 
%             Franklin, Powell, Emami
%
 
clear all;
close all;
clf

%num=[1];
%den=[1];


num = 2000*[1 0.5];
den = conv([1 10 0],[1 50]);

num1 = [1/0.5 1];
den1 = [1 0];

num2 = [1];
den2 = [1/10 1];

num3 = [1];
den3 = [1/50 1 0];


w=logspace(-2,3);

[m,p]=bode(num,den,w);
[m1,p1]=bode(num1,den1,w);
[m2,p2]=bode(num2,den2,w);
[m3,p3]=bode(num3,den3,w);

figure(1)

%loglog(w,m,'LineWidth',2);

loglog(w,m,w,m1,w,m2,w,m3,'LineWidth',2);


grid on;
xlabel('\omega (rad/sec)');
ylabel('Magnitude');

%title('Fig. 6.9 Composite plots (a) magnitude');
%pause;

axis([ 0.01, 1000, 0.1, 1000])
hold on

figure(2)

%semilogx(w,p,'LineWidth',2);

semilogx( w,p,w,p1,w,p2,w,p3,'LineWidth',2);

grid on;
xlabel('\omega (rad/sec)');
ylabel('Phase');

axis([ 0.01, 1000, -180, 0])
hold on

%title('Fig. 6.9 (b) phase');