You are on page 1of 10

LAB 04 MATLAB

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.

There are three methods to obtain the Transfer function in Matlab:

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.

Figure 1-Defining transfer function by using equation

CONTROL ENGINERING LAB Page 1


LAB 04 MATLAB

2. By Using Coefficients:
In this method numerator and denominator, coefficients are used followed by ‘tf’ command.

Figure 2-Defining transfer function by coefficients

 Poles and zeros:


The poles and zeros are properties of the transfer function,
and therefore of the differential equation describing the
input-output system dynamics. Together with the gain
constant K they completely characterize the differential
equation, and provide a complete description of the system.

A system is characterized by its poles and zeros in the sense


that they allow reconstruction of the input/output differential
equation. In general, the poles and zeros of a transfer
function may be complex, and the system dynamics may be
Figure 3-Pole zero diagram
represented graphically by plotting their locations on the
complex s-plane, whose axes represent the real and
imaginary parts of the complex variable s. Such plots are
known as pole-zero plots.

It is usual to mark a zero location by a circle (◦) and a pole


location a cross (×). The location of the poles and zeros
provide qualitative insights into the response characteristics
of a system. Many computer programs are available to
determine the poles and zeros of a system from either the
transfer function or the system state equations.

pzmap(sys1,sys2,...,sysN) plots the pole-zero map of several


LTI models on a single figure. The LTI models can have
Figure 4-Example of pole zero diagram of given
different numbers of inputs and outputs and can be a mix of transfer function
continuous and discrete systems.

 Control system block diagrams:


A block diagram represents a control system in the form of diagram. In other words, a control
system's block diagram is its practical depiction. Each control system element is represented
by a block, which is the symbolic representation of that element's transfer function.

CONTROL ENGINERING LAB Page 2


LAB 04 MATLAB

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.

Figure 5-Typical block diagram

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.

Figure 6-Block diagram of parallel connection

If Cone, Ctwo, and Cthree are the blocks’ outputs with transfer function Gone, Gtwo, and Gthree, then.

Figure 7-Reduction of block diagram

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.

CONTROL ENGINERING LAB Page 3


LAB 04 MATLAB

Figure 8-Typical series connection

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.

Figure 9-Equivalent block diagram

3. Feedback Connection
There are two types of feedback — positive feedback and negative feedback.

Figure 10-Negative feedback control system


We can represent the negative feedback connection of two blocks with a single block. The
transfer function of this single block is the closed loop transfer function of the negative
feedback. The equivalent block diagram is shown below.

Figure 11-Equivalent block diagram

CONTROL ENGINERING LAB Page 4


LAB 04 MATLAB

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);

Figure 12-Task 01 (a)

b)

Code:
syms t s
f = (3*t)^(-2*t) * sin(4*t + 60);

CONTROL ENGINERING LAB Page 5


LAB 04 MATLAB

F = laplace(f, t, s);

pretty(F)

Figure 13-Task 01 (b)

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)

CONTROL ENGINERING LAB Page 6


LAB 04 MATLAB

Figure 14-Task 02 (a)

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)

CONTROL ENGINERING LAB Page 7


LAB 04 MATLAB

Figure 14-Task 02 (b)

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);

CONTROL ENGINERING LAB Page 8


LAB 04 MATLAB

Figure 15-Task 03 (a)

Figure 16-Task 03 (b)

CONTROL ENGINERING LAB Page 9


LAB 04 MATLAB

CONTROL ENGINERING LAB Page 10

You might also like