% Fig. 5.38  Feedback Control of Dynamic Systems, 8e 
%             Franklin, Powell, Emami
%
%script to generate figures 5.38, Piper Dakota autopilot design
 
clf
s=tf('s');

sysG = 160*(s+2.5)*(s+0.7)/((s^2+5*s+40)*(s^2+0.03*s+0.06));

figure(1)
rlocus( sysG )
%rlocus( sysG, '--' )
axis([-5 2 -15 15])

% axis([-3.5 1 -2 2])

%axis('equal')
%grid
hold on

Kp=0.3;
r1 = rlocus(sysG,Kp);
plot(r1,'s', 'MarkerSize', 10, 'MarkerFaceColor','c')


% axis([-30 5 -15 15])
% set(gco,'LineWidth',4)


figure(2)

sysTp = feedback(Kp*sysG,1);
step( sysTp )

% set(gco,'LineWidth',4)