Example H5.9

MATLAB code for example 5.9 from the book "Regeltechniek voor het HBO"

Investigation of the stability in the frequency domain

Copyright (c) 2022, Studieboeken Specialist Permission is granted to copy, modify and redistribute this file, provided that this header message is retained.
Table of Contents

Initialisation

clear all variables from Workspace and close all figures.
clear variables;
close all;
 
% Define 's' variable
s=tf('s');

Investigation of the stability in the frequency domain

In figure 5.17 you see for two different values of K the asymptotic Bode plots of the in this book so called going around gain (" in formula 5.19):
For we can see that where the phase equals () the associated modulus is smaller than 0 dB (this equals ). So for that K the system is stable. Instead of taking as starting point we could also have started from the modulus. Then we have to check whether at 0 dB the phase is greater or less than . It can be seen it is greater (about ; less phase shift than ) and therefore stable.
For we can see that where the phase equals ( again ) the associated modulus is greater than 0 dB (about 4 dB). So for that K the system is unstable. Again we can take or dB as startingpoint. Then we see the phase shift equals about ; too much phase shift and thus unstable.

MATLAB code for this example

% clear all variables from Workspace and close all figures.
clear variables;
close all;
 
% Define 's' variable
s=tf('s');
 
% Determine parameters.
K=5;
Tau1 = 0.2;
Tau2 = 1;
 
% Create the 3rd order proces
H=K/(s*(Tau1*s+1)*(Tau2*s+1));
 
% Create feedback
Hcl=feedback(H,1);
 
 
% Show bode plot of system without feedback
figure(101);
bode(H);
grid on;
 
% Calculate Gain and Phase margin
[Gm,Pm,Wcg,Wcp] = margin(H)
Gm = 1.2000
Pm = 3.9431
Wcg = 2.2361
Wcp = 2.0388
 
% or show it directly in the figure
figure(102);
margin(H);
grid on;