% Fig. 6.31   Feedback Control of Dynamic Systems, 8e 
%             Franklin, Powell, Emami
%

clear all;
close all;
clf

w=logspace(-3,3,100);

num = [1 1];
den = conv([1 0],[0.1 -1]);


figure(1)

rlocus( tf(num, den ) )

axis([-12 12 -4 4]);
axis('equal')

set(findall(gcf,'type','line'),'linewidth',3);
%grid
 
figure(2)

bode( num, den )

set(findall(gcf,'type','line'),'linewidth',3);
grid


figure(3)

[re,im] = nyquist(0.5*num,den,w);
plot(re,im,re,-im,'LineWidth',1);

grid
hold on

plot(-1,0,'*', 'MarkerSize', 12)

axis([-8 4 -6 6]);
xlabel('Re(G(s))');
ylabel('Im(G(s))');


figure(4)

[re,im] = nyquist(1*num,den,w);
plot(re,im,re,-im,'LineWidth',2);

grid
hold on

plot(-1,0,'*', 'MarkerSize', 12)

axis([-8 4 -6 6]);

xlabel('Re(G(s))');
ylabel('Im(G(s))');



figure(5)

[re,im] = nyquist(2*num,den,w);
plot(re,im,re,-im,'LineWidth',3);

grid
hold on

plot(-1,0,'*', 'MarkerSize', 12)

axis([-8 4 -6 6]);

xlabel('Re(G(s))');
ylabel('Im(G(s))');



figure(6)

[re,im] = nyquist(5*num,den,w);
plot(re,im,re,-im,'LineWidth',4);

grid
hold on

plot(-1,0,'*', 'MarkerSize', 12)

axis([-8 4 -6 6]);

xlabel('Re(G(s))');
ylabel('Im(G(s))');



figure(7)

[re,im] = nyquist(0.5*num,den,w);
plot(re,im,re,-im,'LineWidth',1);

grid
hold on

plot(-1,0,'*', 'MarkerSize', 12)

axis([-8 4 -6 6]);


[re,im] = nyquist(num,den,w);
plot(re,im,re,-im,'LineWidth',2);


[re,im] = nyquist(2*num,den,w);
plot(re,im,re,-im,'LineWidth',3);

[re,im] = nyquist(5*num,den,w);
plot(re,im,re,-im,'LineWidth',4);



xlabel('Re(G(s))');
ylabel('Im(G(s))');

title('Nyquist plot for Example 6.10');
grid on
