% Fig. 5.29  Feedback Control of Dynamic Systems, 8e 
%             Franklin, Powell, Emami
%script for Figure 5.29

clear all; close all;
%clf

s=tf('s');

sysG=2500/((s*(s+1))*(s^2+s+2500)); 

sysD1=(s+2)/(s+13);

% 
sysD2=91*(s+0.05)/(s+0.01);

% 
% sysD2=91*(s+0.5)/(s+0.1);
% sysD2=91*(s+5)/(s+1);
% sysD2=91*(s+25)/(s+10);
% sysD2=91*(s+250)/(s+60);

sysDn=((s^2)+0.8*s+3600)/((s+60)^2);

% sysDn=((s^2)+0.8*s+1600)/((s+60)^2);
% sysDn=((s^2)+0.8*s+1600)/((s+40)^2);
% sysDn=((s^2)+0.8*s+1600)/((s+20)^2);


sysD=sysD1*sysD2*sysDn;

sysOL=sysG*sysD;

rlocus(sysOL) 

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

axis([-120 20 -70 70])
 hold on

 title('Root locus,lead,lag, notch')

 
 z=0.1:.2:.9;
  wn=10:20:160;
 sgrid(z, wn)
 
% set(findall(gcf,'type','line'),'linewidth',1);
% set(findall(gcf,'type','line'),'linewidth',2);
% set(findall(gcf,'type','line'),'linewidth',3);

%axis([-20 10 -20 20])
%axis([-5 5 -5 5])
%axis([-0.5 0.1 -0.3 0.3])

hold off
 
% set(gco,'LineWidth',4)
% kick the line and run the setting
