The University of Sheffield
ACS6101 Foundations of Control Systems
Week 4 Assignment
Paulo Roberto Loma Marconi
prlomarconi1@sheffield.ac.uk
November 4, 2018
1 Question 1
The aim of this task is to design a Phase-lead compensator using the Bode analysis in the
frequency domain, and evaluate it in Matlab. Although the plant G(s) is a third-order system
Eq.(1), the design requirements can be approximated in terms of the natural frequency (ω
n
) and
damping ratio (ζ) of a second-order system.
G(s) =
K
s(s + a)(s + b)
(1)
G(s) =
K
s(s + 2.5)(s + 27)
1.1 Determine the gain K for a step response overshoot no more than 10%
There are two steps to follow in order to obtain the required gain K, the first one uses the
second-order performance approximation in the frequency domain, and the second step uses the
gain and angle condition.
The relation between the Percentage Overshoot (P O) in response to a unity step input of a
second-order system in the time domain, and the Phase Margin (P M) of the Bode analysis in
the frequency domain, can be written as follows,
P O = 100 e
ζπ/
1ζ
2
(2)
P M 100 ζ (3)
applying the requirement of P O 10%,
ζ =
ln
100
P.O.
q
π
2
+
ln
100
P.O.

(4)
ζ = 0.59 0.60
Using Eq.(3), the desired Phase Margin (P M
d
) the system should have in order to satisfy the
P O is defined as,
P M
d
= 100 × 0.6 = 60
°
Now, it is necessary to obtain the new crossover frequency (ω
0
c
) where the P M
d
is satisfied.
Using the P M
d
equation and the phase angle condition (φ(ω
0
c
)) as follows,
φ(ω
0
c
) = 180
°
+ P M
d
(5)
1
Registration Number: 180123717
applying the rule of angles into the Eq.(1),
φ(ω
0
c
) = 90
°
arctan
ω
0
c
a
arctan
ω
0
c
b
(6)
and after some algebraic operations ω
0
c
,
P M
d
180
°
= 90
°
arctan
ω
0
c
a
arctan
ω
0
c
b
ω
0
c
(a + b)
a b
=
1
ω
02
c
a b
tan(180
°
90
°
P M
d
)
solving the quadratic equation with the corresponding values a, b, and P M
d
, and using the high
value of the solution,
ω
02
c
+
a + b
tan(180
°
90
°
P M
d
)
ω
0
c
a b = 0 (7)
ω
0
c
= 1.29 rad/sec
Finally, the gain K can be obtained from the gain condition, where it is established that
the new crossover frequency ω
0
c
should be at 0 dB of magnitude, in other words,
|G(jω
0
c
)| = 1 (8)
applying into the plant G, Eq.(1), and replacing the values
K
ω
0
c
p
ω
02
c
+ a
2
p
ω
02
c
+ b
2
= 1
K = ω
0
c
p
ω
02
c
+ a
2
p
ω
02
c
+ b
2
K = 97.96
therefore, the plant becomes,
G(s) =
97.96
s(s + 2.5)(s + 27)
In Fig. 1a it can be seen that the desired P M
d
= 60
°
is satisfied with the new gain, and step
response has an P O = 8.36.
(a) Bode plot (b) Step response
Figure 1: Evaluation of the system with the new gain
The following script in Matlab simulates the previous results.
2
Registration Number: 180123717
%% == = = = = = ====== = = = = = ====== = = = = = ====== = = = = = ====== = = = = = = ===== = = = = = = ====== = = =
% ---- AC S6 10 1 Ass ignme nt week 4
% ---- Reg ist r ati on number : 1801 23717
% ---- Name : Paulo Robert o Loma Ma rc oni
% ---- 23/ 10/20 18
%% === Ques ti on 1 ===== = = = = = ===== = = = = ===== = = = = = ===== = = = = = ===== = = = = ===== = = = =
clear ; clc ; close all ;
%% plant G para met ers
s = tf ( s );
a = 2.5; b = 27;
%% a ) Gain K for PO =10
PO = 10; % p erc entag e o ve rsh oo t
zeta = log (100/ PO )/ sqrt ( pi ^2+ ( log (100/ PO ) ) ^2 ); % damping ratio
PM_d = round (100* zeta ) +1; % PM des ir ed at the n ea re st round value
h = tand (180 -90 - PM_d );
omega_c = roots ([1 (a+b)/h -a * b ]); % new omega_c
K = ome ga _c (2) * sqrt ( omega_c (2) ^2+ a^2) * sqrt ( omega_c (2) ^2+ b ^2) ; % new gain K
G = K /( s *(s+a) *( s + b ) ) ; % Plant G
fig = figure (1) ;
margin (G ) ;
saveas (fig , Q1 _a _ma rgi n . png );
fig = figure (2) ;
step ( feedback (G ,1) );
stepinfo ( feedback (G ,1) )
saveas (fig , Q1_a _st epp . png );
1.2 Design of the Phase-lead compensator
The Phase-Lead compensator has the following transfer function,
Gc =
s + z
s + p
(9)
where the location of the zero is to the left of the pole, |z| < |p|.
The design requirements are the velocity error constant K
v
25, and the step response
P O 10%
The first step is to calculate the loop gain that satisfies the K
v
is calculated as follows,
K
v
= lim
s0
s
K
s(s + 2.5)(s + 27)
(10)
K
g
= 1687
therefore, the new plant is,
G(s) =
K
g
s(s + a)(s + b)
(11)
G(s) =
1687
s(s + 2.5)(s + 27)
Using the Eq.(2), Eq.(4), Eq.(3), it is obtained that for an overshoot of P O = 10%, the
damping ratio is ζ = 0.6, and the desired phase margin is P M
d
= 60
°
.
In order to obtain the ω
c
that satisfies the gain condition with the new gain K, Eq.(8) is
applied as follows,
|G(jω
c
)| = 1
K
g
jω
c
(jω
c
+ a)(jω
c
+ b)
= 1
3
Registration Number: 180123717
after some algebraic operation,
ω
2
c
(ω
2
c
+ a
2
)(ω
2
c
+ b
2
) K
2
g
= 0
ω
c
= 7.55 rad/sec
Now, the actual phase margin P M
act
is needed to calculate the additional phase (φ
m
) required
from the compensator,
P M
a
ct = 180
°
+ φ(ω
c
) (12)
P M
a
ct = 180
°
90
°
arctan
ω
c
a
arctan
ω
c
b
P M
a
ct = 2.65
so, the additional phase angle is,
φ
m
= P M
d
+ θ P M
a
ct (13)
where θ is a factor of correction. If θ = 0,
φ
m
= 60
°
+ 0
°
2.65
φ
m
= 57
°
The additional phase margin is related with the zero and the pole of the Phase-Lead com-
pensator as follows,
α =
sin φ
m
+ 1
1 sin φ
m
(14)
α = 11
where α is,
α =
p
z
(15)
The next step is to determine the new ω
0
c
using the following logarithm gain condition,
20 log |G(jω
0
c
)| = 10 log α (16)
K
g
ω
0
c
p
ω
02
c
+ a
2
p
ω
02
c
+ b
2
=
1
α
(17)
after some operations,
ω
02
c
(ω
02
c
+ a
2
)(ω
02
c
+ b
2
) K
2
g
α = 0
ω
0
c
= 13.50 rad/sec
now, calculating the zero of the compensator,
ω
0
c
=
p z (18)
z =
ω
0
c
α
z = 4.07
4
Registration Number: 180123717
and the pole of the compensator using Eq.(15) is,
p = α z
p = 44.78
The last step is to obtain the new gain of the compensated system,
K
new
=
αK
g
(19)
K
new
= 5596.80
therefore, the compensated open-loop transfer function is as follows,
G
ol
=
s + z
s + p
K
new
s(s + a)(s + b)
(20)
G
ol
=
s + 4.07
s + 44.78
5596.80
s(s + 2.5)(s + 27)
The following Matlab script calculates the Phase-Lead compensator with the design require-
ments.
%% b ) Phase - lead compe nsa tor
Kv = 25; % v el ocity error
Kg = Kv *a * b ; % loop gain to satisfy Kv
G = Kg /( s *( s+ a ) *( s+ b ) ) ; % Plant G
% ome ga _c for the u nco mpen sat ed system
omega_c = real ( sqrt ( roots ([1 a ^2+ b ^2 a ^2* b ^2 -Kg ^2]) ) );
% obta ining actual PM
PM_act = 180 -90 - atand ( ome ga _c (3) /a ) -atand ( omega_c (3) / b ) ;
% ad di tio nal phase angle from the c omp ens ato r PM
theta = 0; % fact or of corre cti on
PM_c = round ( PM_d + theta - PM_ac t );
% ca lcu lat ing alpha
alpha = round ( ( sind ( PM_c ) +1) /(1 - sind ( PM_c )) );
% Dete rmine the new cross over fr eq uen cy
om eg a_c _ne w = real ( sqrt ( roots ([1 a ^2+ b ^2 a ^2* b ^2 -Kg ^2* alpha ]) ) );
% Ca lcu lat ing the zero of the co mpe nsa tor
z = om ega _c_ new (3) / sqrt ( alpha );
% Ca lcu lat ing the pole of the co mpe nsa tor
p = alpha *z ;
% lead co mpe nsa tor
Gc = (s+z) /( s+ p );
% new gain of the co mpe nsa ted system
K_new = sqrt ( alpha ) * Kg ;
% co mpe nsa ted open - loop
Gol = K_new * Gc * G / Kg ;
% closed - loop
Gcl = feedb ac k ( Gol ,1) ;
1.3 Evaluation of the compensated system to a unit ramp input
The unit ramp in the LaPlace domain has the following equation,
R(s) =
1
s
2
(21)
and the steady-state error to that unit ramp is,
ess
v
=
1
K
v
(22)
5
Registration Number: 180123717
where,
K
v
= lim
s0
s G(s) (23)
evaluating K
v
for the compensated system G
ol
,
K
v
= lim
s0
s
s + z
s + p
K
new
s(s + a)(s + b)
K
v
= 7.53
therefore,
ess
v
= 0.13
which is a relatively small steady-state error.
1.4 Evaluation the performance of the compensated system
Fig. 2 shows the Bode plot, unit step response, and the unit ramp response. It can be seen that
the desired P M
d
= 60
°
and the P O = 10% are satisfied, and the system has an improved the
settling time, t
s
= 1.04, see Table 1.
(a) Bode plot. (b) Step and ramp response.
Figure 2: Evaluation of the compensated system.
Quantity Value
Steady state error to a unit ramp 0.13
Rise Time 0.24
Settling Time 1.04
Percentage Overshoot 10.38
Phase Margin 60.20
Gain Margin 22.90
Bandwidth 8.19
Peak Magnitude 0.57
Resonant frequency 3.42
Table 1: Performance evaluation.
The following Matlab script was used to obtain Fig. 2.
6
Registration Number: 180123717
%% c ) eva lua tin g the system to unit step and unit ramp
figure (2) ;
margin ( Gol );
figure (3) ;
subplot (2 ,1 ,1);
step = 1/ s; % step input
impulse (step , Gcl * step );
title ( Step res ponse );
subplot (2 ,1 ,2);
ramp = 1/ s ^2; % ramp input
impulse (ramp , Gcl * ramp );
title ( Ramp res ponse );
% ev al uat ing Kv for the new compen sat ed system
Kv_new = (z/ p ) * K_new /( a* b ) ;
% steady - state error to a unity ramp
ess_ramp = 1/ Kv_ new ;
stepinfo ( Gcl )
% band width of Gcl
BW = bandw id th ( Gcl );
% resonant freq ue ncy
omega_r = 4/ (0. 6*1 .03 ) * sqrt (1 -2*0.6^2) ;
1.5 Conclusion
Comparing the uncompensated system in Fig. 1, and the Phase-Lead compensated system in
Fig. 2, the desired phase margin P M
d
= 60
°
and the overshoot P O 10% were satisfied.
Moreover, the settling time t
s
was improved three times in the Phase-lead compensated, which
demonstrates this compensator improves the transient response without altering the desired
phase margin.
2 Question 2
The objective of this task is to design a Phase-Lead compensator, and a Phase-Lag compensator
in series with the first Phase-Lead compensator using two different approaches.
The plant to be studied is,
G(s) =
K
s
2
(s + a)(s + b)
(24)
G(s) =
K
s
2
(s + 9)(s + 50)
2.1 Determine the location of closed-loop dominant poles
The design requirements are the settling time t
s
2.9 sec, and the overshoot P O 20%. Al-
though the plant is a fourth-order system, the compensator can be designed using the properties
of a second-order system.
The settling time is,
t
s
=
4
ζω
n
(25)
where ζ is the damping ration and ω
n
is the natural frequency. Using Eq.(4), and Eq.(25),
ζ = 0.45, ω
n
= 3.06 rad/sec
7
Registration Number: 180123717
therefore, the desired closed-loop dominant poles are,
r
1,2
= ω
n
ζ ± j ω
n
p
1 ζ
2
(26)
r
1,2
= 1.38 ± j 2.73
The following Matlab script calculates the previous results.
%% == = = = = = ====== = = = = = ====== = = = = = ====== = = = = = ====== = = = = = = ===== = = = = = = ====== = = =
% ---- AC S6 10 1 Ass ignme nt week 4
% ---- Reg ist r ati on number : 1801 23717
% ---- Name : Paulo Robert o Loma Ma rc oni
% ---- 27/ 10/20 18
%% === Ques ti on 2 ===== = = = = = ===== = = = = ===== = = = = = ===== = = = = = ===== = = = = ===== = = = =
clear ; clc ; close all ;
%% plant G para met ers
s = tf ( s );
a = 9; b = 50;
%% a ) L ocation of the d ominant poles for PO =20 and ts =2.9
PO = 20; % p erc entag e o ve rsh oo t
ts = 2.9; % se ttling time
zeta = log (100/ PO )/ sqrt ( pi ^2+ ( log (100/ PO ) ) ^2 ); % damping ratio
zeta = round ( zeta ,2) -0.01;
omega_n = 4/( zeta * ts );
% des ir ed locati on of dominan t poles
s1 = - omega_n * zeta + omega_n * sqrt (1 - zeta ^2) *1 i ;
2.2 Demonstrate the desired poles do not belong to the root locus
In order to demonstrate that the desired dominant poles r
1,2
do not belong to the root locus of
the plant G(s), the angle condition must not be satisfied.
Choosing the pole, r
1
= 1.38 ± j 2.73,
](G(r
1
)) = 180
°
(27)
]
K
r
2
1
(r
1
+ 9)(r
1
+ 50)
= 180
°
]r
1
]r
1
](r
1
+ 9) ](r
1
+ 50) = 80
°
2 arctan
2.73
1.38
arctan
2.73
9 1.38
arctan
2.73
50 1.38
= 180
°
103.44 6= 180
°
if the second pole r
2
is evaluated,
103.44 6= 180
°
2.3 Design of the Phase-Lead compensator
The Phase-Lead compensator has the following transfer function,
G
lead
=
s + z
lead
s + p
lead
, |z
lead
| < |p
lead
| (28)
The design requirement is that the location of the compensator’s zero is 1. Once again, the
angle criteria is applied with the desired pole r
1
as follows,
]
s + z
lead
s + p
lead
K
s
2
(s + a)(s + b)
= 180
°
(29)
]
r
1
+ z
lead
r
1
+ p
lead
K
r
2
1
(r
1
+ a)(r
1
+ b)
= 180
°
]z
lead
]p
lead
2 ]s ]a ]b = 180
°
8
Registration Number: 180123717
if, r
1
= x + j y
180
°
arctan
y
x z
lead
arctan
y
p
lead
x
2
180
°
arctan
y
x
...
arctan
y
a x
arctan
y
b x
= 180
°
after some operations,
p
lead
= 8.36
so, the Phase-Lead compensator is,
G
lead
=
s + 1
s + 8.36
Now, the gain K of the compensated system can be found using the gain condition,
s + z
lead
s + p
lead
K
s
2
(s + 9)(s + 50)
= 1
r
1
+ 1
r
1
+ 8.38
K
r
2
1
(r
1
+ 9)(r
1
+ 50)
= 1
K = 10047
Therefore, evaluating the following open-loop compensated system,
G
ol
= G
lead
G(s) (30)
G
ol
=
s + 1
s + 8.36
10047
s
2
(s + 9)(s + 50)
in Fig. 3 it can be seen that the close-loop desired poles belong to the root locus of the
compensated system, but the overshoot is too high, so, it is recommended to use a Pre-filter to
reduce the overshoot.
The script below simulates the Phase-Lead compensator.
%% c ) Phase lead co mpe nsa tor
z_lead = 1; % locat io n of the desired zero
% using the angle cond ition to deter mine the l ocation of the pole
x = - real (s1 ) ; y = imag ( s1 );
h = 180 + 180 - atand (y /( x - z_lead )) -2*( 180 - atand (y / x ) ) - atand (y /( a -x ) ) ...
- atand ( y /( b -x ) ) ;
p_lead = y/ tand (h ) + x ;
% Gc comp ensator TF
Gc_lead = (s + z_lead ) /( s+ p_lead );
% obta ining the gain K with the gain condit ion e qu ation
K = (( - x ) ^2+ y ^2) * sqrt (( - x + a ) ^2+ y ^2) * sqrt ((- x + b ) ^2+ y ^2) *...
sqrt (( - x+ p_l ead ) ^2+ y ^2) / sqrt (( - x + z_lead ) ^2+ y ^2) ;
% the open - loop syst em
G = K /( s ^2*( s+ a ) *( s+ b ) ) ; % plant G
Gol_lead = Gc_le ad * G ; % open - loop with the Lead co mpe nsa tor
Gcl_lead = f eedback ( Gol_lead ,1) ; % closed - loop with the Lead co mpe nsato r
fig = figure (1) ;
rlocus ( Gcl_l ea d );
hold ;
% plo ti ng the s1 and zeta in the rlocus
n = 0:1:160; m = n * sqrt ( zeta ^2/(1 - zeta ^2) );
axis ([ -4 1 -4 4]) ;
plot ( -m ,n , -- ) ; % zeta
9
Registration Number: 180123717
(a) Root locus. (b) Step response.
(c) Bode plot.
Figure 3: Closed-loop system with the Lead compensator.
plot ( -x ,y , rd );
saveas (fig , Q2 _Le a d_r loc u s . png );
fig = figure (2) ;
step ( Gcl_lead ) ;
saveas (fig , Q2 _Le ad_ ste p . png );
fig = figure (3) ;
margin ( Gcl_l ea d );
saveas (fig , Q2 _Le a d_m arg i n . png );
BW_lead = band wi dth ( Gc l_lead ); % band wi dth
2.4 Adding a Pre-filter
The use of a Pre-filter in series with the closed-loop systems can reduce the overshoot canceling
the effect of the Phase-Lead’s zero.
The Pre-filter is written as follows,
G
pf
=
p
s + p
(31)
10
Registration Number: 180123717
where p can be at the exact point of the z
lead
= 1,
G
pf
=
1
s + 1
applying to the closed-loop Phase-Lead compensated system and evaluating it,
G
lead+prefilter
= G
pf
G
ol
1 + G
ol
G
lead+prefilter
=
1
s + 1
10047 (s + 1)
(s + 50)(s + 13.07)(s + 1.64)(s
2
+ 2.76 s + 9.40)
Fig. 4 shows the result on implementing a Pre-filter, where the overshoot decreases dramat-
ically with a small change in the settling time.
(a) Step response. (b) Bode plot
Figure 4: Closed-loop Lead compensated in series with a Pre-filter.
The Matlab script below calculates and implements the Pre-filter.
%% Using pref ilter to reduce the oversh oo t
pf = z_lea d ; % sele cting the zero of the lead com pen sat or ( z_lead )
Gpf = pf /( s+ pf );
fig = figure (3) ;
step ( Gpf * Gcl_lead ) ;
saveas (fig , Q2_ Le ad + pref ilt er_s tep . png ) ;
fig = figure (4) ;
margin ( Gpf * Gcl_lead ) ;
saveas (fig , Q2_ Le ad + p ref ilte r_ma rgin . png );
BW _lea d_pr e fil t er = ba ndwid th ( Gpf * Gcl_lead ) ; % ban dw idt h
2.5 Design of the Phase-Lag compensator
The Phase-Lag compensator has the following transfer function,
G
lag
=
s + z
lag
s + p
lag
, |p
lag
| < |z
lag
| (32)
This compensator will be used in series with the Phase-Lead compensator designed in the previ-
ous task. And now, the design requirement is the steady-state error (ess
a
) for a parabolic input
0.5At
2
2.5%.
11
Registration Number: 180123717
First, obtaining the LaPlace transform of the parabolic input,
r(t) = 0.5At
2
, R(s) =
A
s
3
according to the final value theorem,
ess = lim
s0
s
A
s
3
1
1 + G
(33)
if K
a
= lim
s0
s
2
G, the steady-state error is,
ess
a
=
A
K
a
(34)
where K
a
is the acceleration error constant.
If ess
a
= 0.025 and A = 1, the desired acceleration error constant (K
a
d
) is obtained using
Eq.(34),
K
a
d
=
1
ess
a
K
a
d
= 40
and again, with A = 1 and G = G
ol
from Eq.(30), the actual acceleration error constant K
a
act
is,
K
a
act
= lim
s0
s
2
G
ol
= K
a
act
= 2.67
The relation between the zero z
lag
and the pole p
lag
of the Phase-Lag compensator can be
written as follows,
α =
K
a
d
K
a
act
=
z
lag
p
lag
(35)
α = 14.97
choosing a z
lag
ten times smaller than the real part of the desired dominant pole r
1
,
z
lag
=
1.38
10
z
lag
= 0.14
and the pole should be,
p
lag
=
z
lag
α
p
lag
= 0.0092
therefore, the Phase-Lag compensator becomes,
G
lag
=
s + 0.14
s + 0.0092
The Matlab script of the Phase-Lag compensator is presented below.
12
Registration Number: 180123717
%% d ) Phase - lag c ompen sat or
ess_a = 0.0 25; % steady - state error for a par aboli c input 0.5 At ^2
Ka_d = 1/ ess_a ; % Ka desired
Ka_act = ( z_lead / p_lead ) *( K /(a*b));
% ca lcu lat ing the zero and pole of the co mpe nsa tor
alpha = Ka_d / Ka_a ct ;
z_lag = abs ( x ) /10;
p_lag = z_lag / alpha ;
% Gc phase - lag c omp ensat or
Gc_lag = (s+ z_lag ) /( s+ p_lag );
2.6 Evaluation of the performance
Finally, the open-loop of the Phase-Lead compensator in series with the Phase-Lag compensator
is written as follows,
G
ol1
= G
lag
G
lead
G(s) (36)
G
ol1
=
s + 0.14
s + 0.0092
s + 1
s + 8.36
10047
s
2
(s + 9)(s + 50)
and the Pre-filter with the closed-loop systems is,
G
lag+lead+prefilter
= G
pf
G
ol1
1 + G
ol1
(37)
G
lag+lead+prefilter
= G
pf
10047(s + 1)(s + 0.14)
(s + 50)(s + 13.05)(s + 1.78)(s + 0.14)(s
2
+ 2.51 s + 8.75)
Fig. 5c shows the step response of the system with and without the Pre-filter, it is clear
that the Pre-filter reduces the overshoot in both cases with good settling time, the performance
results can be seen in Table 2. On the other hand, in Fig. 5a, the desired dominant poles are
slightly out of the root locus, it is recommended to add a second Phase-lead compensator in
series in order correct that gap.
Quantity Lead Prefilter+Lead Lead+Lag Prefilter+Lead+Lag
Rise Time 0.37 1.00 0.36 0.94
Settling Time 2.79 3.08 3.59 3.31
Percentage Overshoot 51.46 0.07 57.96 1.79
Phase Margin 40.80 -180 36.60 36.60
Gain Margin 8.96 7.07 8.51 8.51
Bandwidth 4.87 2.31 4.89 2.58
Peak Magnitude 1.51 1.00 1.58 1.02
Table 2: Performance evaluation to unit step response
The following Matlab script was used to evaluate the performance of the previous systems.
%% Evalua tin g the perf orm anc e with the phase - lead , phase - lag and p refil ter
Go l_l ead _la g = Gc_lead * Gc_lag *G ;
Gc l_l ead _la g = feedb ac k ( Gol_lead _lag ,1) ;
fig = figure (5) ;
rlocus ( Gcl_ lea d_l ag );
hold ;
% plo ti ng the s1 and zeta in the rlocus
n = 0:1:160; m = n * sqrt ( zeta ^2/(1 - zeta ^2) );
axis ([ -4 1 -4 4]) ;
plot ( -m ,n , -- ) ; % zeta
13
Registration Number: 180123717
(a) Root locus of the Lead and Lag closed-loop com-
pensator system.
(b) Bode plot of the closed-loop system.
(c) Step response of the closed-loop system.
Figure 5: Phase-lead, Phase-lag in series, and the Pre-filter.
plot ( -x ,y , rd );
saveas (fig , Q2_ Le ad + Lag _r loc us . png );
fig = figure (6) ;
step ( Gcl_lead , Gpf * Gcl_lead , Gcl_lead_ lag , Gpf * Gcl _le ad_ lag )
legend ( Lead , Pre - filter + Lead , Lead + Lag , Pre - filter + Lead + Lag ...
, Loca ti on , south east );
saveas (fig , Q2 _Al l_s t ep_ 1 . png );
stepinfo ( Gpf * G cl_ lea d_l ag )
fig = figure (7) ;
margin ( Gcl_ lea d_l ag );
saveas (fig , Q2_ Le ad + lag _m arg in . png );
BW _l ead _la g = ban dwidt h ( Gc l_l ead _la g ) ; % bandw idth
fig = figure (8) ;
margin ( Gcl_ lea d_l ag );
14
Registration Number: 180123717
saveas (fig , Q2_ Le ad + lag + p refi lter _mar gin . png );
BW _ lea d _ lag _ p ref i lter = bandwi dth ( Gpf * Gcl _le ad_l ag ); % b andwi dth
%% V erifing Ka = 40
Ka = ( z_lag / p_lag ) * ( z_lead / p_le ad ) * ( K /( a* b ) ) ;
es s_p ara boli c = a / Ka ;
2.7 New Phase-Lead compensator
Fig. 5a demonstrates that the desired dominant closed-loop poles have moved slightly from the
root locus, therefore, a new Phase-Lead compensator is calculated to correct that shift.
This time, the location of the zero is exactly below the real part of the desired pole, z
lead 2
=
1.38. Applying the angle condition with the desired pole r
1
as follows,
]
s + z
lead 2
s + p
lead 2
s + z
lag
s + p
lag
s + z
lead
s + p
lead
K
s
2
(s + a)(s + b)
= 180
°
(38)
]
r
1
+ z
lead 2
r
1
+ p
lead 2
r
1
+ z
lag
r
1
+ p
lag
r
1
+ z
lead
r
1
+ p
lead
K
r
2
1
(r
1
+ a)(r
1
+ b)
= 180
°
]z
lead 2
+ ]z
lag
+ ]z
lead
]p
lead 2
]p
lag
]p
lead
2 ]s ]a ]b = 180
°
if, r
1
= x + j y
arctan
y
x z
lead 2
+
180
°
arctan
y
x z
lag
+
180
°
arctan
y
x z
lead
...
arctan
y
p
lead 2
180
°
arctan
y
x p
lag
arctan
y
p
lead
x
2
180
°
arctan
y
x
...
arctan
y
a x
arctan
y
b x
= 180
°
after some operations,
p
lead 2
= 1.48
so, the second Phase-Lead compensator is,
G
lead 2
=
s + 1.38
s + 1.48
Now, the new gain K
new
of the compensated system can be found using the gain condition,
K
new
s + z
lead 2
s + p
lead 2
s + z
lag
s + p
lag
s + z
lead
s + p
lead
K
s
2
(s + a)(s + b)
= 1 (39)
K
new
r
1
+ z
lead 2
r
1
+ p
lead 2
r
1
+ z
lag
r
1
+ p
lag
r
1
+ z
lead
r
1
+ p
lead
K
r
2
1
(r
1
+ a)(r
1
+ b)
= 1
K
new
= 1
which means that the gain has not changed.
The following script in Matlab simulates the previous results.
%% New phase - lead c omp ens ato r
z_lead2 = x; % given zero lead right below the d es ir ed pole
f = 180 + atand (y /( x - z_le ad2 )) +(180 - atand (y /( x - z_lag )) ) ...
+(180 - atand (y /( x - z_lead ) ) ) - (180 - atand (y /( x - p_lag ) )) - atand (y /( p_lead - x ) ) ...
-2*(180 - atand (y/x)) - atand ( y /( a -x ) ) -atand (y /(b -x ) ) ;
% p_l ea d2 = y / tand (180+ f) - x;
15
Registration Number: 180123717
p_lead2 = y/ tand (f ) + x ;
Gc_lead2 = ( s + z_lead2 ) /( s+ p_lead2 );
% Ca lcu lat ing the new gain K with the lead 2 co mpe nsa tor
K_new = sqrt (( - x + p_lead2 ) ^2+ y ^2) * sqrt (( - x+ p_lag ) ^2+ y ^2) *...
sqrt (( - x+ p_l ead ) ^2+ y ^2) *(( - x ) ^2+ y ^2) * sqrt (( -x+a) ^2+ y ^2) * sqrt (( -x+b) ^2+ y ^2) /...
( sqrt (( - x + z_lead ) ^2+ y ^2) * sqrt ((- x + z_lag ) ^2+ y ^2) * sqrt ((- x + z_lead ) ^2+ y ^2) * K ) ;
Go l_le a d2_ l ead _ lag = K_new * Gc_ lead2 * Gol _le ad_ lag ;
Gc l_le a d2_ l ead _ lag = fe ed back ( Gol _lead 2_lea d_lag ,1) ;
%% V erifing Ka = 40
Ka_new = K_new *( z_lead2 / p_lead2 )*( z_lag / p_lag ) *( z_lead / p_lead )*( K /( a* b ) ) ;
es s_pa rabo l ic_ n ew = a/ Ka_new ;
2.8 Evaluation of the performance with the second Phase-Lead compensator
The open-loop of the new Phase-Lead compensator in series with the previous compensators is
written as follows,
G
ol2
= G
lead 2
G
lag
G
lead
G(s) (40)
G
ol2
=
s + 1.38
s + 1.48
s + 0.14
s + 0.0092
s + 1
s + 8.36
10047
s
2
(s + 9)(s + 50)
and the Pre-filter with the closed-loop systems is,
G
lag+lead+prefilter
= G
pf
G
ol2
1 + G
ol2
(41)
G
lag+lead+prefilter
= G
pf
10047(s + 1.38)(s + 1)(s + 0.14)
(s + 8.36)(s + 1.48)(s + 0.009)s
2
(s + 9)(s + 50)
From Fig. 6a it can be seen that the desired closed-loop poles are exactly in the root locus.
Also, the P M has changed a little with respect of the previous compensated system, from 36.60
°
to 39.50
°
, Fig. 6b. On the other hand, the step response has been improved with the Pre-filter
and the new Phase-Lead compensator, see Table 3.
Quantity Lead Prefilter
+Lead
Lead
+Lag
Prefilter
+Lead
+Lag
Lead 2
+Lead
+Lag
Prefilter
+Lead 2
+Lead
+Lag
Rise Time 0.37 1.00 0.36 0.94 0.37 0.97
Settling Time 2.79 3.08 3.59 3.31 2.87 1.68
Percentage
Overshoot
51.46 0.07 57.96 1.79 55.00 1.25
Phase Margin 40.80 -180 36.60 36.60 39.50 -180
Gain Margin 8.96 7.07 8.51 8.51 8.79 6.79
Bandwidth 4.87 2.31 4.89 2.58 4.88 2.42
Peak Magnitude 1.51 1.00 1.58 1.02 1.55 1.01
Table 3: Performance evaluation to unit step response
The following script in Matlab simulates the previous results.
%% Com parin g the new compensa tor of the pre vious designs .
fig = figure (9) ;
rlocus ( Gc l_l e ad2_ lead _ lag )
hold on ;
% plo ti ng the s1 and zeta in the rlocus
n = 0:1:160; m = n * sqrt ( zeta ^2/(1 - zeta ^2) );
16
Registration Number: 180123717
(a) Root locus (b) Bode plot of the open-loop system without the Pre-
filter.
(c) Bode plot of the closed-loop system with the Pre-
filter
(d) Step response of the closed-loop system.
Figure 6: Phase-lead 2, Phase-lead, Phase-lag in series, and the Pre-filter.
axis ([ -4 1 -4 4]) ;
plot ( -m ,n , -- ) ; % zeta
plot ( -x ,y , rd );
saveas (fig , Q2_Lead2 + Lead + Lag_ rlo cus . png );
fig = figure (10) ;
% step ( Gcl _lead 2_ lea d_ lag , Gpf * Gc l_le ad2_ l ead _ lag )
step ( Gcl_lead , Gpf * Gcl_lead , Gcl_lead_ lag , Gpf * Gcl_l ead_lag ,...
Gcl_ lead2 _l ead_l ag , Gpf * G cl_l ead2 _ lea d _la g )
legend ( Lead , Pre - filter + Lead , Lead + Lag , Pre - filte r + Lead + Lag ...
, Lead 2+ Lead + Lag , Pre - filter + Lead2 + Lead + Lag , Location , sout heast );
saveas (fig , Q2 _Al l_s t ep_ 2 . png );
stepinfo ( Gpf * G c l_l e ad2_ l ead _ lag )
fig = figure (11) ;
margin ( Gc l_l e ad2_ lead _ lag ) ;
saveas (fig , Q2_Lead2 + lead + lag_ mar gin . png );
BW _lea d2_l e ad_ l ag = ba ndwid th ( Gc l_le ad2_ l ead _ lag ) ; % b andwi dth
fig = figure (12) ;
margin ( Gpf * Gc l _le a d2_l ead_ l ag );
saveas (fig , Q2_Lead2 + lead + lag + pr e fil t er_ m arg i n . png );
BW _ lead 2 _ lead _ l ag_p r e filt e r = b andwi dth ( Gpf * G cl_ l ead2 _ lea d _la g ) ; % b an dwidt h
17
Registration Number: 180123717
2.9 Conclusion
The settling time requirement t
s
2.9 was satisfied by three of the six compensators, and only
the last one with the Pre-filter achieved the desired overshoot P O 20%. It is clear that the
use of the Pre-filter reduces the overshoot drastically.
18