DEPARTMENT OF ELECTRICAL ENGINEERING
FACULTY MEMBER: YASIR RIZWAN DATED: 27th June, 2024
SEMESTER: SPRING 2024 SECTION: BEE
EE-371: LINEAR CONTROL SYSTEMS
LAB 1: LAPLACE TRANSFORM, TRANSFER FUNCTIONS AND
CONTROL SYSTEM TOOLBOX IN MATLAB
PLO8/
PLO4/ PLO4/ PLO5/ PLO9/
CLO7
CLO5 CLO5 CLO6 CLO8
Analysis of
Viva / Quiz Ethics and Individual
data in Modern
/ Lab Safety and Team
Name Reg. No Lab Tool Usage
Performanc Work
Report
e
5 Marks 5 Marks 5 Marks 5 Marks 5 Marks
Muhammad Huzaifa 369168
Shahmeer Hussain 371074
Muneeb Ur Rehman 392702
MATLAB CODE:
syms t;
g1 = t*sin(2*t) + exp(-2*t);
g2 = sin(2*t)*cos(2*t);
g3 = exp(-t) * cos(3*t);
g4 = -exp(-t) + 9*t*exp(-t) + 5*exp(-2*t) + t-2;
g5 = 5*t^2*cos(3*t+45);
G1 = laplace(g1)
G2 = laplace(g2)
G3 = laplace(g3)
G4 = laplace(g4)
G5 = laplace(g5)
OUTPUT:
MATLAB CODE:
syms s;
G1= 1/(s*(s+2)*(s+3));
G2= 10/((s+1)*(s+3));
G3= 2*(s+1)/(s*(s^2+s+2));
G4= s+1/((s+2)*(s^2+2*s+2));
g2 = ilaplace(G1)
g2 = ilaplace(G2)
g3 = ilaplace(G3)
g4 = ilaplace(G4)
OUTPUT:
MATLAB CODE:
G1 = 5*(s+2)*(s-5)/(s^2 + 7*s +12);
[z, p, k] = getPoleZero(G1)
%% Get ZP Data
function [z, p, k] = getPoleZero(sys)
[n, d] = numden(sys);
num = flip(coeffs(n));
den = flip(coeffs(d));
num = double(num);
den = double(den);
G1 = tf(num, den);
[z p k] = zpkdata(G1);
z=z{1};
p=p{1};
end
OUTPUT:
%%_______________________
num = [30 180];
den = [1 4 13 7];
G1 = tf(num,den)
G1 = zpk(G1)
%%_______________________
num = [1 0 1 1];
den = [1 1 0 6];
G2 = tf(num,den)
G2 = zpk(G2)
%%_______________________
z = [-4, -(2-4i), -(2+4i)];
p = [2, -4, -5i, 5i];
k = 1;
MATLAB CODE:
G3 = zpk(z,p,k)
G3 = tf(G3)
%%_______________________
num = [1 11 35 250];
den = [1 4 39 108 0 0];
G4 = tf(num,den)
G4 = zpk(G4)
%%_______________________
num = [1 5 6];
den = [1 0 4 0 15 35];
G5 = tf(num,den)
G5 = zpk(G5)
%%_______________________
num =[1 0 1];
den = [1 0 4 6 4];
G6 = tf(num,den)
G6 = zpk(G6)
%%_______________________
OUTPUT:
MATLAB CODE:
%%_______________________
num = [30 180];
den = [1 4 13 7];
G1 = tf(num,den)
%%_______________________
num = [1 0 1 1];
den = [1 1 0 6];
G2 = tf(num,den)
%%_______________________
z = [-4, -(2-4i), -(2+4i)];
p = [2, -4, -5i, 5i];
k = 1;
G3 = zpk(z,p,k)
%%_______________________
zplot(G1,1)
zplot(G2,2)
zplot(G3,3)
%% PZ Plot (Custom plot function)
function [] = zplot(sys, i)
subplot(2,2,i);
pzplot(sys);
den = [1 1 0 6];
G2 = tf(num,den)
%%_______________________
z = [-4, -(2-4i), -(2+4i)];
p = [2, -4, -5i, 5i];
k = 1;
G3 = zpk(z,p,k)
%%_______________________
zplot(G1,1)
zplot(G2,2)
zplot(G3,3)
%% PZ Plot (Custom plot function)
function [] = zplot(sys, i)
subplot(2,2,i);
pzplot(sys);
[z p] = zpkdata(sys); z=abs(z{1});p=abs(p{1});
mx=max(p);
if (max(z) > max(p))
mx=max(z);
end
mx = ceil(mx);
axis([-mx mx -mx mx]);
hold on;
% Draw the unit circle
theta = linspace(0, 2*pi, 100);
x = cos(theta);
y = sin(theta);
plot(x, y, 'k--', 'LineWidth', 1);
hold off;
end
OUTPUT:
SIMULINK MODEL:
Conclusion:
In this lab, we explored essential concepts in Laplace transforms, transfer functions, and the
application of MATLAB tools. The lab's objectives encompassed an introduction to the MATLAB
Control Systems Toolbox, a widely used software tool for control engineers, and MATLAB Simulink, a
powerful platform for dynamic system modeling and simulation. Practical exercises involved the
calculation of Laplace and inverse Laplace transforms in MATLAB, emphasizing the advantages of
utilizing symbolic variables and dedicated functions. We also learned to represent transfer functions,
both in coefficient and zero-pole-gain forms, using MATLAB functions like tf() and zpk(). The
significance of the MATLAB Control System Toolbox was highlighted, offering industry-standard
algorithms for control system analysis and design. Simulink modeling was introduced, enabling us to
create block diagrams for given transfer functions and explore numerical and symbolic
representations. The lab further emphasized pole-zero plotting using the pzplot() command in
MATLAB, providing a visual tool for understanding system characteristics.