% bigpict.m
%
% Matlab script for the figures in Chapter 8.
% written by Kent Lundberg, October 2003.

s = tf('s');
L = 3e4*(0.05*s+1)^2/(s+1)^3/(0.01*s+1);

%% Closed-Loop Pole-Zero Map 
% pzmap(L/(1+L)) draws a bunch of pole-zero 
% cancellations. Instead of L/(1+L), use
pzmap(1/(1+1/L))
axis([-60 20 -80 80]) 
title('Closed-Loop Pole-Zero Map (K = 30,000)')
pause

%% Root Locus
rlocus(L)
axis([-120 20 -200 200])
pause

%% Nyquist Diagram
nyquist(L)
pause

%% Hall Chart
nyquist(L)
grid
axis([-2 0 -1 1])  
title('Hall Chart')
pause

%% Nichols Chart
nichols(L)
grid
axis([-270 -90 -40 40])
pause

%% Bode Diagram with gain margin and phase margin
margin(L)
pause

%% Closed-Loop Bode Diagram
bode(L/(1+L))
grid
title('Closed-Loop Bode Diagram')
pause

%% Step Response
step(L/(1+L))
grid

