% control_eng.sce                         

% Plot Bode, Nyquist, Nichols & Black's,  /
% and Evans for defined equations         /

clear,clc,clf;

% Definition of systems:
%-------------------------------
s = tf('s');   % Polynomial seed
Gain1 = (s^2+20*s+100)/(s^2+6*s+100);
Gain2 = Gain1*(s^2+3*s+220)/(s^2+25*s+225);
Gain3 = (5+s)/(s*s*(s-2000)*(s-200)*(s-25)*(s-1));
Gain4 = 352*Gain3;

% Bode plot:
%---------------
subplot(221)
bodemag(Gain2,Gain1,0.01,100)  % Magnitude plot

% Nyquist plot:
%-------------------
subplot(222)
nyquist(Gain2,Gain1)  % Plot with Re and Im axes

% Nichols chart (Black's diagram + iso-plots):
%-------------------------------------------------------------
subplot(223)
nichols(Gain2,Gain1,0.01,10)


% Evans root locus:
%-------------------------
subplot(224)
rlocus(Gain4)   % Evans root locus for sys4

