ADAMA SCIENCE AND TECHNOLOGY UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING AND COMPUTING
DEPARTMENT OF ELECTRONICS AND COMMUNICATIONS ENGINEERING
Course Title: Introduction to Control System
Course Code: EPCE3204
LAB-NO: 1
Title: Mathematical Modeling of Control System Using MATLAB
Prepared by:
Name Id. No
1. Tsinat Theodros----------------------------UGR/25843/14
2. Eden Yilma---------------------------------UGR/25539/14
3. Samuel Haylay------------------------------UGR/23163/13
Submitted to: Lab assistant.-Wondosen.B
Section: 3
Date of Conduction: 17th April, 2024 G.C
Date of submission: 15th May, 2024 G.C
ACKNOWLEDGEMENT
We would like to acknowledge our lab assistant Wondosen for his support and explanation
in the laboratory. Through the group work and experiment we were able to comprehend the
topics that were raised and able to communicate with each other well.
LAB 1: Mathematical Modeling of Control System Using MATLAB
OBJECTIVE
To study importance of mathematical modeling of physical systems in design and
analysis of control systems by using MATLAB software application.
APPARATUS REQUIRED AND SOFTWARE REQUIRED
MATLAB
THEORY
The dynamic performance of physical systems is obtained by utilizing the physical laws
of mechanical, electrical, fluid and thermodynamic systems. We generally model
physical systems with linear differential equations with constant coefficients when
possible. Other models can be derived from more general differential equations.
The transfer function of a linear, time-invariant, differential equation system is defined as
the ratio of the Laplace transform of the output variable to the Laplace transform of the
input variable, with all initial conditions assumed to be zero. Although the transfer
function can be used only for linear systems, it yields more intuitive information than the
differential equation. The characteristic equation is obtained by setting the denominator
polynomials of the transfer function to zero. The roots of the denominator are the system
poles, and the roots of the numerator are the system zeros. The system transfer function
can then be specified to within a constant by specifying the system poles and zeros. The
constant, usually denoted by K, is the system gain factor. The transfer function model
enables us to change system parameters and rapidly sense the effect of these changes on
the system response. The transfer function is also useful in modeling the interconnection
of subsystems by forming a block diagram representation. The time response of a system
is obtained by the inverse transform of the s-domain response. This usually requires
expansion of the rational function using partial fractions.
The Control System Toolbox function sys = tf(num, den) creates a continuous-time
transfer function. The output sys is a tf object. For SISO models, num and den are row
vectors listing the numerator and denominator coefficients in descending powers of s.
Consider the following differential equation:
𝑑𝑛𝑦(𝑡) 𝑑𝑛−1(𝑡) 𝑎1
𝑎 +
𝑛 +⋯+
𝑛 𝑑𝑡
𝑎𝑛−1 𝑑𝑡𝑛−1
𝑑𝑦( 𝑡) + 𝑎0(𝑡)
𝑑𝑡
= 𝑏𝑚 𝑑𝑚𝑢(𝑡) 𝑑𝑚𝑢(𝑡) 𝑑𝑢(𝑡)
+ +⋯+ 𝑑𝑡 + 𝑏0(𝑡)
𝑑𝑡𝑚 𝑑𝑡 𝑚
𝑏1
𝑏𝑚−1
𝑛𝑢𝑚 = [𝑏𝑚 𝑏𝑚−1 … 𝑏1 𝑏0]
By taking the coefficients:
𝑑𝑒𝑛 = [𝑎𝑛 𝑎𝑛−1 … 𝑎1 𝑎0]
The transfer function can be determined using a MATLAB function tf:
𝑆𝑦𝑠𝑡𝑒𝑚 = 𝑡𝑓(𝑛𝑢𝑚, 𝑑𝑒𝑛)
Result will be:
𝑆𝑦𝑠𝑡𝑒𝑚 =𝑏𝑚𝑠𝑚 + 𝑏𝑚−1𝑠𝑚−1 + ⋯ + 𝑏1𝑠 + 𝑏0
𝑎𝑛𝑠𝑛 + 𝑎𝑛−1𝑠𝑛−1 + ⋯ + 𝑎1𝑠 + 𝑎0
The roots of the numerator of the transfer function are called zeros, whereas the roots of
the denominator are called poles. Calculating the poles and zeros of the transfer
function is important to understand the characteristics of the system.
To calculate the time response of the transfer function, it is very important to describe the
transfer function in partial fraction. So, it is going to be ease to calculate the time
(𝑠) = 𝑏𝑚𝑠𝑚 + 𝑏𝑚−1𝑠𝑚−1 + ⋯ + 𝑏1𝑠 + 𝑏0 = 𝑟1 + ⋯ + 𝑟𝑛 +
response.
𝑘(𝑠)
(𝑠) an𝑠n + 𝑏n−1𝑠n−1 + ⋯ + a1𝑠 + a0 𝑠 − 𝑝1 𝑠 − 𝑝n
Where 𝑟𝑛 is called the residues of the partial fraction expansion at the pole 𝑝𝑛.
Polynomial Roots and Characteristic Polynomial
If p is a row vector containing the coefficients of a polynomial, roots(p) returns a
column vector whose elements are the roots of the polynomial. If r is a column vector
containing the roots of a polynomial, poly(r) returns a row vector whose elements are
the coefficients of the polynomial.
QUESTIONS
Example 1: Consider the mechanical system shown in the following figure. The
system is initially at rest, and the displacement x is measured from the equilibrium
position. Assume that m = 1 kg, b= 12 N-s/m, and k = 100 N/m. First obtain the
differential equation that describe the mechanical system manually, then determine the
transfer function using MATLAB.
Example 2: Find the roots of the following polynomial
s6 + 9s5 + 31.25s4 + 61.25s3 + 67.75s2 + 14.75s + 15
Example 3:The roots of a polynomial are −1, −2, −3 ± j4. Determine the polynomial
equation.
Example 4:Find the poles and zeros of the following transfer function:
s3 + 11s2 + 30s
H(s) =
s4 + 9s3 + 452 + 87s + 50
Example 5: A system has zeros at -6, -5, 0, poles at −3 ± j4, −2, −1, and a gain of
1. Determine the system transfer function
Example 6: Determine the partial fraction expansion for
2s3 + 9s + 1
F (s) =
s3 + s2 + 4s + 4
PROCEDURE:
EX1: To Calculate the Mathematical Model
1. Differential equation of the mechanical system of figure 1 was derived
using physical laws like Newton’s laws, damper equation and spring law.
figure 1
2. The transfer equation of the mechanical system was calculated from the
differential equation.
EX2&3: To calculate polynomial roots and Characteristic polynomial
1. New MATLAB script was opened.
2. The coefficients of polynomial function were assigned to p as a row vector.
3. Roots of the polynomial function was calculated on MATLAB using function roots(p).
4. The polynomial function was generated from its roots using MATLAB
function called poly(r) where r is column vector of roots of the polynomial.
5. So, from step 1 to step 4 was performed using the following code:
clear all
clc
% to solve the polynomial root
p= [1 9 31.25 61.25 67.75 14.75 15];
r=roots(p)
%to generate the polynomial from the
root
r= [-1, -2, -3+4i, -3-4i];
p=poly(r)
EX 4&5: To Calculate Poles and Zeros of a Transfer Function and Vice versa
1. New MATLAB script was opened.
2. The coefficient of numerator and denominator of the transfer function was assigned
to num and den row vector respectively.
3. Zeros and poles of the transfer function was calculated on MATLAB using function
tf2zp(num, den).
4. The numerator and denominator coefficient of the transfer function was generated
from its zeros, poles and gain using MATLAB function called zp2tf(z, p, k) where
z, p, and k is column vector of zeros, poles and gain of the transfer function.
5. So, from step 1 to step 4 was performed using the following code:
clear
all clc
% to solve the zeros and poles of the transfer
function
num = [1 11 30 0];
den = [1 9 45 87 50];
[z, p, k] = tf2zp(num, den)
%to generate the transfer function from the zeros
and poles
z=[-6; -5; 0]; k=1;
p = [-1; -2; -3+4i; -3-4i];
[num, den] = zp2tf(z, p, k)
EX6: To Calculate Partial-Fraction Expansion
1. New MATLAB script was opened.
2. The coefficient of numerator and denominator of the rational function was
assigned to num and den row vector respectively.
3. Residue, poles and constant of the rational function was calculated on
MATLAB using function residue(num, den).
4. So, from step 1 to step 3 was performed using the following code:
clear
all clc
num = [2 0 9 1];
den = [1 1 4 4];
[res, poles, k] = residue(num, den)
EXCERSISE
TASK1. Consider the mechanical system depicted in the following Figure. The input is given
by f (t) and the output is y(t). Determine the transfer function from f(t) to y(t) and, using an m-
file, plot the system response to a unit step input. Let m= 10, k = 1, and b = 0.5
TASK2. Find the pole-zero form of the following transfer function using MATLAB
s3 + 9s2 + 26s + 24
G(s) =
s4 + 6.5s3 + 14.75s2 + 13.375s + 3.75
RESULT AND DISCUSSION
EX1. To calculate mathematical model
𝑑2𝑥(𝑡) 𝑑𝑥(𝑡)
Differential equation
+ 12 + 100𝑥(𝑡) =
𝑑𝑡
𝑃(𝑡)
2
𝑑𝑡
Ex2&3. To calculate polynomial roots and Characteristic polynomial
To calculate roots from polynomial function
Output:
To generate polynomial function’s coefficient from roots
Output:
p = [1 9 45 87 50]
EX4&5: : To Calculate Poles and Zeros of a Transfer Function and Vice versa
To calculate poles and zeros from transfer function
Output:
z = [0; -6.0000; -5.0000]
p = [ -3.0000 + 4.0000i;
-3.0000 - 4.0000i;
-2.0000 + 0.0000i;
-1.0000 + 0.0000i]
k =1
To generate transfer function’s numerator and denominator from zeros and
poles
Output:
num = [0 1 11 30 0]
den = [1 9 45 87 50]
EX6. To Calculate Partial-Fraction Expansion
Poles & Residue belongs to the pole
Output:
poles = [0.0000 + 2.0000i; 0.0000 - 2.0000i; -1.0000 + 0.0000i]
res = [-0.0000 - 0.2500i; 0.0000 + 0.2500i; -2.0000 + 0.0000i]
k= 2.0000
The partial fraction expansion
−2 𝑗0.25
Output:
−𝑗0.25 2 +
+ +
𝑠 + 1 𝑠 + 𝑗2 𝑠 − 𝑗2
TASK1. The transfer function of mechanical system given at TASK1 figure 2 first
𝑑2(𝑡)
the differential equation must be calculated. So the force on the object become
𝑚 + b 𝑑(𝑡) + 𝑘𝑦(𝑡) = 𝑓(𝑡)
𝑑𝑡2 𝑑𝑡
So, the transfer function become,
(𝑠) 1
=
(𝑠) 𝑚𝑠 + 𝑏𝑠 + 𝑘
2
Then using m-file the plot for the time response when the unit step applied and m= 10,
k=1, and b=0.5 become,
figure 3:
𝑠3 + 9𝑠2 + 26𝑠 + 24
TASK2. The poles and zeros of the transfer function given below become
𝐺(𝑠) = 4
𝑠 + 6.5𝑠3 + 14.75𝑠2 + 13.375𝑠 + 3.75
Zeros: 𝑧1 = −4.0, 𝑧2 = −3.0 , 𝑧3 = −2
poles: 𝑝1 = −2.5, p2 =−1.0 , p3 = −2.0 𝑎𝑛𝑑 p4 = −0.5.
CONCLUSION
Physical systems can be represented using mathematical model that make easy to
work on the system. Transfer function, which usually used to represent linear
function, is represented in rational function. So, each numerator and denominator
polynomial function root become zeros and poles of the transfer function.
In order to calculate the time response of the transfer function, the function must
be expanded to partial fraction expansion. These all calculation become more
complex and difficult when the order of the system increase consequently
MATLAB is used to ease this all complexity and difficulty.