Hassan Bevrani
Professor, University of Kurdistan
Fall 2023
H. Bevrani University of Kurdistan 1
Contents
1. Mass-Spring Control System
2. Nominal System
3. Uncertain System
4. Closed-Loop Evaluation
5. Multiplicative and Additive Uncertainties
H. Bevrani University of Kurdistan 2
Reference
1. M. Hirata, Practical Robust Control,
CORONA Press , 2017 (In Japanese).
H. Bevrani University of Kurdistan 3
Mass Control System (Nominal)
One Mass Model:
PD Controller:
H. Bevrani University of Kurdistan 4
Continue
!# = %" $ & !! = 2$%" &
! !
! +2#$" !+ $"
% = $" ! '+ 2#$" '!
H. Bevrani University of Kurdistan 5
MATLAB Example 1
Assuming ' = 1 and ) = 1, for the following !! values, plot
the step response and bode diagram of the closed-loop system:
!! = 2.5
!! = 0.5
H. Bevrani University of Kurdistan 6
MATLAB Program 1
%% Mass System Control
rng('default') % Initializing random numbers
%% Defining the nominal model(one-mass model)
s = tf('s'); % Definition of Laplace operator s
M = 1; % mass
Pn = 1/(M*s^2); % nominal model(1/(Ms^2)
Eta=1;
%% PD controller[approximate differentiator s/(0.01s+1)]
Omega_n = 0.5;
K1 = Omega_n^2*M + 2*Eta*Omega_n*M*s/(0.01*s+1);
Omega_n = 2.5;
K2 = Omega_n^2*M + 2*Eta*Omega_n*M*s/(0.01*s+1);
%% Response calculation for nominal model
Tn1 = feedback(Pn*K1,1);
Tn2 = feedback(Pn*K2,1);
figure(1);
step(Tn1,'--',Tn2,10);
ylim([0 1.4]);
legend('\omega_n = 0.5','\omega_n = 2.5');
figure(2);
bodemag(Tn1,'--',Tn2);
legend('\omega_n = 0.5','\omega_n = 2.5');
H. Bevrani University of Kurdistan 7
Results
Bode Diagram
20
_n = 0.5
_n = 2.5
-20
Magnitude (dB)
-40
-60
-80
-100
-120
-1 0 1 2 3 4
10 10 10 10 10 10
Frequency (rad/s)
figure(1) figure(2)
H. Bevrani University of Kurdistan 8
Mass Plant with additional Mass-Spring-Damper System (Uncertainty)
Two-Mass Model:
H. Bevrani University of Kurdistan 9
MATLAB Example 2
The nominal parameters and uncertainties are given in the
following Table. Plot the bod diagrams of the uncertain plant
and compare it with the given plant in Example 1.
Assume ' = 1.
Parameters
Nominal
Perturbation
H. Bevrani University of Kurdistan 10
MATLAB Program 2
%% Definition of perturbation model
% Define the fluctuation parameters using ureal
m1 = ureal('m1',0.8,'percent',10); % 10% perturbation
m2 = M - m1; % m1+m2=M
k = ureal('k',300,'percent',10); % 10% perturbation
c = ureal('c',1,'percent',10); % 10% perturbation
% Two mass model definition
P = (c*s+k)/(s^2*(m1*m2*s^2 + (m1+m2)*c*s + (m1+m2)*k));
% Select 50 models from the model set
P = usample(P,50);
figure(3)
bodemag(Pn,P,'--',{1e1,1e3});
legend('One-mass system','Two-mass system with
uncertainty');
H. Bevrani University of Kurdistan 11
Results
Bode Diagram
-20
One-mass system
Two-mass system with uncertainty
-40
-60
-80
Magnitude (dB)
figure(3) -100
-120
-140
-160
-180
10 1 10 2 10 3
Frequency (rad/s)
H. Bevrani University of Kurdistan 12
Uncertain Mass System Control: MATLAB Example 3
Evaluate the closed-loop system for the designed PD controllers
in Example 1, and the uncertain plant of Example 2:
H. Bevrani University of Kurdistan 13
MATLAB Program 3
%% Response Evaluation for perturbation model
T1 = feedback(P*K1,1);
T2 = feedback(P*K2,1);
figure(4);
step(T1,'--',T2,10);
ylim([0 1.4]);
legend('\omega_n = 0.5','\omega_n = 2.5');
figure(5);
nyquist(P*K1);
axis([-1.5 0.5 -1 1]);
legend('\omega_n = 0.5');
figure(6);
nyquist(P*K2);
axis([-1.5 0.5 -1 1]);
legend('\omega_n = 2.5');
H. Bevrani University of Kurdistan 14
Results
figure(4)
H. Bevrani University of Kurdistan 15
Results
figure(5) figure(6)
H. Bevrani University of Kurdistan 16
Multiplicative Uncertainty Modeling: MATLAB Example 4
Uncertainty in a system is modeled in form of output
multiplicative as follows:
1
'=
)+1
2)
+$ =
) + 10
∆ % ≤1
Plot the bode diagrams of nominal and uncertain systems.
H. Bevrani University of Kurdistan 17
MATLAB Program 4
%% Multiplicative Uncertainty
close all;
clear all;
rng('default'); % Initializing random numbers
s = tf('s');
Pn = 1/(s+1); % Nominal model
W2 = 2*s/(s+10); % Gain characteristics of multiplicative
uncertainty
delta = ultidyn('delta',[1 1],'SampleStateDim',4);
% meaning of arguments
% 'delta' : perturbation name
% [1 1] : Perturbation size (1 row and 1 column)
% 'SampleStateDim' : perturbation order
P = (1+W2*delta)*Pn;
P = usample(P,50);
w = logspace(-2,2,100);
bodemag(P,Pn,w);
H. Bevrani University of Kurdistan 18
Results
Bode Diagram
10
-10
Magnitude (dB)
-20
figure(4)
-30
-40
-50
-60
-2 -1 0 1 2
10 10 10 10 10
Frequency (rad/s)
H. Bevrani University of Kurdistan 19
Multiplicative and Additive Uncertainty Modeling: MATLAB Example 5
Uncertainty in a standard 2nd order
!!"
system is modeled in the following
multiplicative and additive forms:
%" $ ∆ % ≤1
'= $
) +2$%" )+ %" $
Parameters perturbation: $ = 0.1 ±20% (0.1) !!#
%" = 1 ±20% (1)
Plot the bode diagrams of uncertain system and uncertainties.
H. Bevrani University of Kurdistan 20
MATLAB Program 5
%% Multiplicative and Additive Uncertainty Models
close all; clear all;
rng('default'); % Initializing random numbers
% Define real variation parameters
Eta_n = ureal('omega',1,'percent',20);
zeta = ureal('zeta',0.1,'percent',20);
% Transfer function definition
s = tf('s');
P = Eta_n^2/(s^2+2*zeta*Eta_n*s+Eta_n^2);
% Frequency response calculation
w = logspace(-2,2,100);
P_g = ufrd(P,w); % Use "ufrd" instead of "frd" when including uncertainties
% multiplicative perturbation
Wm = (P_g - P_g.nominal)/P_g.nominal;
% additive Uncertainty
Wa = P_g - P_g.nominal;
% Gain plot
figure(1);
bodemag(P_g,Wm,'--');
legend('P','Wm');
figure(2);
bodemag(P_g,Wa,'--');
legend('P','Wa');
H. Bevrani University of Kurdistan 21
Results
Bode Diagram Bode Diagram
20 20
P P
Wm Wa
0
0
-20
-20
Magnitude (dB)
Magnitude (dB)
-40
-40
-60
-60
-80
-80
-100
-100 -120
10 -2 10 -1 10 0 10 1 10 2 10 -2 10 -1 10 0 10 1 10 2
Frequency (rad/s) Frequency (rad/s)
figure(1) figure(2)
H. Bevrani University of Kurdistan 22
4th-order Mass-Spring-Damper System with Uncertainty
System and Dynamic Model:
H. Bevrani University of Kurdistan 23
Continue
H. Bevrani University of Kurdistan 24
MATLAB Example 6
The nominal parameters and uncertainty are given bellow. Plot
the bod diagrams of the uncertain plant.
Uncertainty: Parameters Value
20% perturbation in !$
H. Bevrani University of Kurdistan 25
MATLAB Program 6
%% 4th order Mass-Spring-Damper System
%% Parameter definition
m1 = 0.8; m2 = 0.2; k1 = 100;
k2 = ureal('k2',300,'percent',20);
c1 = 1; c2 = 0.3; Ks = 100;
%% Define the M, K, C matrices of the motion equation
M = [ m1, 0 ; 0, m2 ];
C = [ c1+c2, -c2 ; -c2, c2 ];
K = [ k1+k2, -k2 ; -k2, k2 ];
F = [ Ks ; 0 ];
%% State space realization
iM = inv(M);
Ap = [ zeros(2,2), eye(2,2) ; -iM*K, -iM*C ];
Bp = [ zeros(2,1) ; iM*F ];
Cp = [ 0 1 0 0 ];
Dp = 0;
%% Bode plot of the plant
P = ss(Ap,Bp,Cp,Dp);
figure(1);
bode(P,{1e0,1e2}); % Bode plot
H. Bevrani University of Kurdistan 26
Results
Bode Diagram
20
0
Magnitude (dB)
-20
-40
-60
0
-90
Phase (deg)
-180
-270
-360
0 1 2
10 10 10
Frequency (rad/s)
H. Bevrani University of Kurdistan 27
Uncertainties and its Cover (MATLAB Program 7)
If for the 4th order plant given in example 6, the uncertainty
transfer function (cover) is determined as follows. Plot
multiplicative uncertainties.
H. Bevrani University of Kurdistan 28
MATLAB Program 7
%% Uncertainties (Deltam) and its Cover (Wm)
%% Multiplicative uncertainty model
w = logspace(0,3,100); % Definition of frequency vector
P_g = ufrd(P,w); % Frequency response calculation
Dm_g = (P_g - P_g.nominal)/P_g.nominal; % Computing multiplicative uncertainty
%% Definition of weight Wm
s = tf('s');
Wm = 3*s^2/(s^2+18*s+45^2);
%% Gain plot
bodemag(Dm_g,'--',Wm,'r-',w);
legend('\Deltam','Wm');
H. Bevrani University of Kurdistan 29
Results
Bode Diagram
20
m
Wm
-20
Magnitude (dB)
-40
-60
-80
-100
-120
0 1 2 3
10 10 10 10
Frequency (rad/s)
H. Bevrani University of Kurdistan 30
Thank You!
H. Bevrani University of Kurdistan 31