Lab 04 - Husnain Z
Lab 04 - Husnain Z
Lab 04 - Husnain Z
LAB SESSION 04
Objective:
To practice generating and analyzing the transfer functions and roots of some basic
MATLAB’s Control systems.
Theory:
Control functions:
Control functions (also known as two-stage residual inclusion) are statistical methods to
correct for endogeneity problems by modelling the endogeneity in the error term. The
approach thereby differs in important ways from other models that try to account for the same
econometric problem.
In matlab control functions are organized by a control system toolbox. The control system
toolbox is a collection of algorithms, written mostly as Mfiles, that implements common
control system design, analysis, and modeling techniques. Convenient graphical user
interfaces (GUI's) simplify typical control engineering tasks. Control systems can be modeled
as transfer functions, in zero-pole-gain, or state-space form. help control gives a list of the
different functions. The most commonly used functions are presented below, with some
common modes of usage documented. You are encouraged to look through the help files for
other functions and options that you might find useful in future.
Transfer functions:
The transfer function of the LTI system is the ratio of the Laplace transform of output to the
Laplace transform of input of the system by assuming all the initial conditions are zero.
1. By Using Equation:
First, we need to declare ‘s’ is a transfer function then type the whole equation in the
command window or Matlab editor. In this ‘s’ is the transfer function variable.
2. By Using Coefficients:
In this method numerator and denominator, coefficients are used followed by ‘tf’ command.
Block diagrams are used to simplify complex control systems. Each element of the control
system is represented with a block, and the block is the symbolic representation of that
element’s transfer function. A complete control system can be represented with a required
number of interconnected blocks.
The figure below shows two elements with transfer function G one(s) and Gtwo(s). Where Gone(s)
is the transfer function of the first element and G two(s) is the transfer function of the second
element of the system.
The diagram also shows there is a feedback path through which output signal C(s) is fed back
and compared with the input R(s). The difference between input and output is which is acting
as the actuating signal or error signal.
1. Parallel connection
When the same input signal is applied, different blocks and the output from each of them are
added in a summing point for taking the system’s final output. The system’s overall transfer
function will be the algebraic sum of the transfer function of all individual blocks.
If Cone, Ctwo, and Cthree are the blocks’ outputs with transfer function Gone, Gtwo, and Gthree, then.
2. Series connection
It is also called cascade connection. In the following figure, two blocks having transfer
functions G1(s) and G2(s) are connected in series.
we can represent the series connection of two blocks with a single block. The transfer
function of this single block is the product of the transfer functions of those two blocks. The
equivalent block diagram is shown below.
3. Feedback Connection
There are two types of feedback — positive feedback and negative feedback.
Task 01
Use MATLAB and the symbolic math toolbox to find the LaPlace transform of the following
time function.
a)
2
f =8 t ×[cos ( 3 t+ 45 ) ]
Code
syms = t;
'a'
theta = 45*pi/180;
f=8*t^2*cos(3*t+theta);
pretty (f);
F=laplace (f);
pretty(F);
b)
Code:
syms t s
f = (3*t)^(-2*t) * sin(4*t + 60);
F = laplace(f, t, s);
pretty(F)
Task 02
Use MATLAB and the Symbolic Math Toolbox to find the inverse Laplace transform of the
following frequency functions:
a)
( s2 +3 s+10 ) ( s+5 )
G ( s )=
( s +3 ) ( s +4 ) ( s 2 +2 s+ 100 )
Code:
syms s t
G = (s^2 + 3*s + 10)*(s + 5)/((s + 3)*(s + 4)*(s^2 + 2*s + 100));
g = ilaplace(G, s, t);
pretty(g)
b)
(¿ 2+ 4 s2 +2 s)+6
G ( s )=
( s +8 ) ( s2 +8 s+3 ) ( s 2+5 s+7 )
Code:
syms s t
G = ((s^2 + 4*s + 2) + 6)/((s + 8)*(s^2 + 8*s + 3)*(s^2 + 5*s + 7));
g = ilaplace(G, s, t);
pretty(g)
Task 03
Find out the roots of a transfer function and plot the poles and zeros
Given the transfer function:
T(s) = (S^3+3s^2+5) / {(s^2+5s+4)(s^2+2s+9)}
Code:
num = [1 3 0 5];
den = conv([1 5 4],[1 2 9])
T = tf(num, den);
zeros_T = roots(num);
poles_T = roots(den);
disp("Zeros of T(s):");
disp(zeros_T);
pzmap(T)
disp("Poles of T(s):");
disp(poles_T);