%  Figure 5.45  Feedback Control of Dynamic Systems, 8e 
%                   Franklin, Powell, Emami

clear all; close all

clf
s=tf('s');

KA = 1;

sysL1 = s/(s^2+s+KA);  % from Eq. (5.86), with KA = 4

sysL2 = 1/(s^2+2*s+KA);  % from Eq. (5.86), with KA = 4

sysL3 = 1/(s^2+3*s+KA);  % from Eq. (5.86), with KA = 4

sysL4 = 1/(s^2+4*s+KA);  % from Eq. (5.86), with KA = 4

figure(1)

rlocus( sysL1, '--' );    % roots vs. K_T
axis([-5 2 -3 3])
hold on
 
title('Root Locus vs. K_T ')
%grid on
%hold off

set(findall(gcf,'type','line'),'linewidth',3);
% set(gco,'LineWidth',4)



figure(2)

rlocus( sysL2 );    % roots vs. K_T
axis([-5 2 -3 3])
hold on
 
title('Root Locus vs. K_1 (K_A=K_1+4)')
%grid on
%hold off


set(findall(gcf,'type','line'),'linewidth',3);
% set(gco,'LineWidth',4)


figure(3)

rlocus( sysL2 );    % roots vs. K_T
axis([-5 2 -3 3])
hold on
 
title('Root Locus vs. K_T and K_1 (K_A=K_1+K_A)')

rlocus( sysL1, '--' );    % roots vs. K_T
 

%grid on
%hold off


set(findall(gcf,'type','line'),'linewidth',3);
% set(gco,'LineWidth',4)




figure(4)

rlocus( sysL2 );    % roots vs. K_T
hold on

rlocus( sysL3, '.' );    % roots vs. K_T

rlocus( sysL4, 'x' );    % roots vs. K_T

axis([-5 2 -3 3])
 
title('Root Locus vs. K_T=1,2,3 and K_1 (K_A=K_1+K_A)')

rlocus( sysL1, '--' );    % roots vs. K_T
 

%grid on
%hold off


set(findall(gcf,'type','line'),'linewidth',3);
% set(gco,'LineWidth',4)