Department of Electrical and Electronic Engineering
University of Information Technology and Sciences
EEE 406: Control Systems Lab
Experiment No. 1: Familiarization with the MATLAB and determination of roots, transfer
function and poles and zeros of control system.
Objectives: To learn to use MATLAB to (1) generate polynomials, (2) manipulate
polynomials, (3) generate transfer functions, (4) manipulate transfer functions.
Introduction:
𝑑𝑑𝑛𝑛 𝑐𝑐(𝑡𝑡) 𝑑𝑑𝑛𝑛−1 𝑐𝑐(𝑡𝑡) 𝑑𝑑𝑑𝑑 (𝑡𝑡)
𝑎𝑎𝑛𝑛 + 𝑎𝑎𝑛𝑛 −1 + ⋯ … … + 𝑎𝑎0
𝑑𝑑𝑑𝑑 𝑑𝑑𝑑𝑑 𝑑𝑑𝑑𝑑
𝑚𝑚 ( ) 𝑚𝑚 −1 ( )
𝑑𝑑 𝑟𝑟 𝑡𝑡 𝑑𝑑 𝑟𝑟 𝑡𝑡 𝑑𝑑𝑑𝑑(𝑡𝑡)
= 𝑏𝑏𝑚𝑚 + 𝑏𝑏𝑚𝑚 −1 + ⋯ … … + 𝑏𝑏0
𝑑𝑑𝑑𝑑 𝑑𝑑𝑑𝑑 𝑑𝑑𝑑𝑑
𝐶𝐶 (𝑆𝑆) 𝑎𝑎𝑛𝑛 𝑆𝑆 𝑛𝑛 + 𝑎𝑎𝑛𝑛−1 𝑆𝑆 𝑛𝑛−1 + ⋯ … … + 𝑎𝑎0 𝑁𝑁(𝑆𝑆)
𝐺𝐺 (𝑆𝑆) = = =
𝑅𝑅 (𝑆𝑆) 𝑏𝑏𝑛𝑛 𝑆𝑆 𝑚𝑚 + 𝑏𝑏𝑚𝑚 −1 𝑆𝑆 𝑛𝑛−1 + ⋯ … … + 𝑏𝑏0 𝐷𝐷 (𝑆𝑆)
Numerator polynomial, 𝑁𝑁(𝑆𝑆) = 𝑎𝑎𝑛𝑛 𝑆𝑆 𝑛𝑛 + 𝑎𝑎𝑛𝑛−1 𝑆𝑆 𝑛𝑛−1 + ⋯ … … + 𝑎𝑎0
Root: Value of variable, S for which 𝑁𝑁(𝑆𝑆) = 0.
Poles: Values of variable, S for which 𝐺𝐺 (𝑆𝑆) = ∞ ⟹ 𝐷𝐷 (𝑆𝑆) = 0.
Zeros: Values of variable, S for which 𝐺𝐺 (𝑆𝑆) = 0 ⟹ 𝑁𝑁(𝑆𝑆) = 0.
Tools:
MATLAB and the Control System Toolbox
MATLAB Functions:
1. roots
2. poly
3. conv
4. polyval
5. tf
Result & Analysis:
Example 1:
𝑃𝑃(𝑠𝑠) = 𝑠𝑠 2 + 3𝑠𝑠 + 4
MATLAB Code:
p = [1 3 4];
r = roots(p)
r=
-1.5000 + 1.3229i
-1.5000 - 1.3229i
p = poly(r)
p=
1.0000 3.0000 4.0000
Example 2:
𝑃𝑃(𝑠𝑠) = 4𝑠𝑠 4 + 2𝑠𝑠 3 + 5𝑠𝑠 2 + 6
MATLAB Code:
p = [4 2 5 0 6];
r = roots(p)
r=
-0.6999 + 1.0187i
-0.6999 - 1.0187i
0.4499 + 0.8829i
0.4499 - 0.8829i
p = poly(r)
p=
1.0000 0.5000 1.2500 0.0000 1.5000
Example 3:
𝑁𝑁(𝑠𝑠) = (3𝑠𝑠 2 + 2𝑠𝑠 + 1)(𝑠𝑠 + 4)
MATLAB Code:
p = [3 2 1];
q = [1 4];
n = conv(p, q)
n=
3 14 9 4
value = polyval (n,-5)
value =
-66
Example 4:
10
𝑁𝑁1 (𝑠𝑠) =
𝑠𝑠 2 + 2𝑠𝑠 + 5
1
𝑁𝑁2 (𝑠𝑠) =
𝑠𝑠 + 1
MATLAB Code:
num1 = [10];
den1 = [1 2 5];
sys1 = tf(num1, den1)
Transfer function:
10
-------------
s^2 + 2 s + 5
num2 = [1];
den2 = [1,1];
sys2 = tf(num2, den2)
Transfer function:
1
-----
s+1
sys = sys1 + sys2
Transfer function:
s^2 + 12 s + 15
---------------------
s^3 + 3 s^2 + 7 s + 5
Example 5:
6𝑠𝑠 2 + 1
𝐺𝐺 (𝑠𝑠) = 3
𝑥𝑥 + 3𝑠𝑠 2 + 3𝑠𝑠 + 1
(𝑠𝑠 + 1)(𝑠𝑠 + 2)
𝐻𝐻 (𝑠𝑠) =
(𝑠𝑠 + 2𝑖𝑖)(𝑠𝑠 − 2𝑖𝑖)(𝑠𝑠 + 3)
MATLAB Code:
numg = [6 0 1]; deng = [1 3 3 1];
sysg = tf(numg, deng);
z = zero(sysg)
z=
0 + 0.4082i
0 - 0.4082i
p = pole(sysg)
p=
-1.0000 + 0.0000i
-1.0000 - 0.0000i
-1.0000
n1 = [1 1];
n2 = [1 2];
d1 = [1 2*i];
d2 = [1 -2*i];
d3 = [1 3];
numh = conv(n1, n2);
denh = conv(d1, conv(d2, d3));
sysh = tf(numh, denh)
Transfer function:
s^2 + 3 s + 2
----------------------
s^3 + 3 s^2 + 4 s + 12
sysg = tf(numg, deng)
Transfer function:
6 s^2 + 1
---------------------
s^3 + 3 s^2 + 3 s + 1
sys=sysg / sysh
Transfer function:
6 s^5 + 18 s^4 + 25 s^3 + 75 s^2 + 4 s + 12
-------------------------------------------
s^5 + 6 s^4 + 14 s^3 + 16 s^2 + 9 s + 2
pzmap(sys)
MATLAB Figure:
Pole-Zero Map
2.5
1.5
0.5
Imaginary Axis
-0.5
-1
-1.5
-2
-2.5
-3 -2.5 -2 -1.5 -1 -0.5 0
Real Axis
Example 6:
(𝑠𝑠 + 1)(𝑠𝑠 + 5)
𝐺𝐺1 (𝑠𝑠) =
(2𝑠𝑠 3 + 𝑠𝑠 2 + 5)(3𝑠𝑠 2 + 2𝑠𝑠 + 6)
10
𝐺𝐺2 (𝑠𝑠) =
(𝑠𝑠 3 − 6𝑠𝑠 2 + 10)(𝑠𝑠 2 + 5)(𝑠𝑠 + 1)
MATLAB Code:
numa1 = [1 1];
numa2 = [1 5];
dena1 = [2 1 0 5];
dena2 = [3 0 2 6];
numg1 = conv(numa1, numa2);
deng1 = conv(dena1, dena2);
numg2 = [10];
denb1 = [1 -6 0 10];
denb2 = [1 0 5];
denb3 = [1 1];
deng2 = conv(denb1, conv(denb2, denb3));
sysg1 = tf(numg1, deng1)
Transfer function:
𝑠𝑠 2 + 6𝑠𝑠 + 5
6𝑠𝑠 6 + 3𝑠𝑠 5 + 4𝑠𝑠 4 + 29𝑠𝑠 3 + 6𝑠𝑠 2 + 10𝑠𝑠 + 30
sysg2 = tf(numg2, deng2)
10
Transfer function:
𝑠𝑠 6 −5𝑠𝑠 5 −𝑠𝑠 4 −15𝑠𝑠 3 −20𝑠𝑠 2 +50𝑠𝑠+50
sysm=sysg1 * sysg2
Transfer function:
10𝑠𝑠 2 + 60𝑠𝑠 + 50
6𝑠𝑠12 − 27𝑠𝑠11 − 17𝑠𝑠10 − 84𝑠𝑠 9 − 308𝑠𝑠 8 + 131𝑠𝑠 7− 91𝑠𝑠 6 − 480𝑠𝑠 5 + 1350𝑠𝑠 4 + 1100𝑠𝑠 3 + 200𝑠𝑠 2 + 2000𝑠𝑠 + 1500
sysd = sysg1 / sysg2
Transfer function:
𝑠𝑠 8 + 𝑠𝑠 7 − 26𝑠𝑠 6 − 46𝑠𝑠 5 − 115𝑠𝑠 4 − 145𝑠𝑠 3 + 250𝑠𝑠 2 + 550𝑠𝑠 + 250
60𝑠𝑠 6 + 30𝑠𝑠 5 + 40𝑠𝑠 4 + 290𝑠𝑠 3 + 60𝑠𝑠 2 + 100𝑠𝑠 + 300
pzmap(sysd)
pzmap(sysm)
MATLAB Figure:
For sysm
Pole-Zero Map
2.5
1.5
0.5
Imaginary Axis
-0.5
-1
-1.5
-2
-2.5
-6 -4 -2 0 2 4 6
Real Axis
For sysd
Pole-Zero Map
2.5
1.5
0.5
Imaginary Axis
-0.5
-1
-1.5
-2
-2.5
-6 -4 -2 0 2 4 6
Real Axis
References:
Control Systems Engineering (6th Edition) by Norman S. Nise. John Wiley & Sons, Inc.