Department of Electrical Engineering
Faculty Member:_Dr. Iftikhar Rana______ Dated: ___06/02/2020____
Semester:__________6th ______________ Section: ______A_________
EE-379: Control Systems
Lab 1: Laplace Transform, Transfer Functions and Control
System Toolbox in MATLAB
CLO3/PLO4/BT Level B4 PLO4/PLO5, CLO5/ CLO6/
BT PLO8 PLO9
levelA3,A4
Name Reg. No Viva / Analysis Modern Ethics Individual
Quiz / Lab of data Tool and and Team
Performa in Lab Usage Safety Work
nce Report
5 Marks 5 Marks 5 Marks 5 Marks 5 Marks
Huzaifah Tariq 210430
Faraz Nazir 213780
Objectives of Lab 1
EE-379: Control Systems Page 1
The objectives of the first lab are:
An introduction to MATLAB Control systems toolbox, which is one of the most popular
software tools used by control engineers.
An introduction to MATLAB Simulink, another very popular software tool.
Learn how to find Laplace and inverse Laplace transforms in MATLAB.
Find how to represent transfer functions (or models) in MATLAB and Simulink.
Introduction:
Laplace Transform transforms a function of a real variable t to a function of a complex variable
s. The purpose of this conversion is to transform ordinary differential equations into algebraic
equations, which makes it easier to solve ODE’s. Inverse transform simply converts the function back
into time domain. These properties allow it to be used for solving and analyzing linear dynamical
systems and optimization purposes.
Lab Tasks
Task 1:
(a) Laplace Transform
MATLAB Code:
%Laplace Transform
syms t;
g1t = t*sin(2*t)+exp(-2*t);
G1s = laplace(g1t)
g2t = sin(2*t) * cos(2*t);
G2s = laplace(g2t)
g3t = exp(-1*t) * cos(3*t);
G3s = laplace(g3t)
g4t = -1 *exp(-1*t) + 9*t*exp(-1*t) + 5*exp(-2*t) +t -2;
EE-379: Control Systems Page 2
G4s = laplace(g4t)
g5t = (5*t^2) * cos(3*t + 45);
G5s = laplace(g5t)
Output:
(b) Inverse Laplace Transform
MATLAB Code:
%Inverse Laplace Transform
syms s;
G1s = 1/(s*(s+2)*(s+3));
g1t = ilaplace(G1s)
G2s = 10/(s+3)*(s+2)^2;
g2t = ilaplace(G2s)
G3s = 2*(s+1)/(s^2 + s + 2);
g3t = ilaplace(G3s)
EE-379: Control Systems Page 3
G4s = (s+1)/(s*(s+2)*(s^2 + s + 2));
g4t = ilaplace(G4s)
Output:
Task 2:
Poles and Zeros of Transfer Function
MATLAB Code:
syms s;
num = [5 10];
den = [1 7 12];
G1 = tf(num,den)
disp('The POLES of system are :');
p = pole(system)
disp('The ZEROS of system are :');
z = zero(system)
Output:
EE-379: Control Systems Page 4
Task 3:
Transfer Functions
MATLAB Code:
syms s;
num = [30 -180];
den = [1 4 13 7];
G1 = tf(num,den);
G1_zpk = zpk(G1)
num = [1 0 1 1];
den = [1 1 0 6];
G2 = tf(num,den);
G2_zpk = zpk(G2)
z = [-4 -2+4*j -2-4*j]
p = [2 -4 -5*i 5*i]
k = 1
G3 = zpk(z,p,k);
G3_tf = tf(G3)
EE-379: Control Systems Page 5
num = [1 11 35 250];
den = [1 4 39 108];
G4 = tf(num,den);
G4_zpk = zpk(G4)
num = [1 5 6];
den = [1 4 15 35];
G5 = tf(num,den);
G5_zpk = zpk(G5)
num = [1 0 -1];
den = [1 4 6 4];
G6 = tf(num,den);
G6_zpk = zpk(G6)
Output:
EE-379: Control Systems Page 6
Task 4:
Poles and Zeros
MATLAB Code:
syms s;
G1 = tf([30 -180],[1 4 13 7]);
figure(1)
pzplot(G1)
EE-379: Control Systems Page 7
G2 = tf([1 0 1 1],[1 1 0 6]);
figure(2)
pzplot(G2)
G3 = tf([1 11 35 250], [1 4 39 108]);
figure(3)
pzplot(G3)
Output:
EE-379: Control Systems Page 8
EE-379: Control Systems Page 9
Task 5:
Simulink
Task 6:
Simulink
EE-379: Control Systems Page 10
MATLAB Code:
M=0.5;
m=0.5;
b=0.1;
L=0.3;
I=0.006;
q=(M+m)*(I+m*L^2)-(m*L)^2;
g=9.80;
num = [(m*L)/q 0 0];
den = [1 (b*(I+m*(L^2)))/q -(((M+m)*m*g*L)/q) -((m*g*L)/q) 0];
G1 = tf(num,den)
pzplot(G1)
EE-379: Control Systems Page 11
Output:
Conclusion:
In this lab, we learned the basic procedure of calculating the Laplace and inverse Laplace in
MATLAB using the laplace () and ilaplace () functions respectively. The functionality of transfer
function tf () and zeros, poles, gain zpk () were also observed in detail. Moreover, we used Simulink to
form various transfer functions. We also learned the procedure to create a generalized form of
transfer function using the same software.
EE-379: Control Systems Page 12