Lab2 Control System
Lab2 Control System
Lab2 Control System
LAB 2
Control System Using MATLAB
LAB 2
Transfer Functions & Step
Response
The Laplace Transform
The Laplace transform is a mathematical operation that takes an
equation from being a function of time, t, to being a function of the
Laplace variable, s
L [ f (t )] f (t )e dt F ( s )
st
0
.1 δ(t) t 1
1 1
.2 )t(1
t s
1
.3 t t s2
1
.5 e -at
s+a
ω
.5 sin (ωt)
s 2 + ω2
s
.6 cos (ωt)
s 2 + ω2
:For example
The Laplace of the following equation in MATLAB
f(t)= sin(t)
;Syms t
f=sin(t)
Laplace(f)
:exercise
Find the Laplace of the following equation in MATLAB
f(x)= 2x + cos(2x)
Open Loop Control system
An open-loop control system takes input under the
consideration and doesn’t react on the feedback to obtain the
output. This is why it is also called a non-feedback control
.system
Closed Loop Control system
A closed loop system is also referred as a feedback control system. These
systems record the output instead of input and modify it according to the
need. It generates preferred condition of the output as compared to the
.original one. It doesn’t encounter any external or internal disturbances
Transfer Function
Often it is desired to remain in the Laplace domain for analysis and
manipulation
The transfer function G(s) of a system is an alternative model to the
differential equation and is defined as the ratio of the Laplace transform of
the output Y(s) to the Laplace transform of the input U(s) assuming zero
initial conditions
L [output ] Y (s)
G ( s)
L [input ] init cond 0 U ( s )
BLOCK DIAGRAMS
Y (s)
G
is(often
s ) drawn as a block diagram
U ( s)
U(s) Y(s)
G(s)
R + Em Y
- C(s) G(s) P(s)
Ym
H(s)
In Matlab: s=tf(‘s’)
G=(10*s)/(s^2+25*s+100)
IN MATLAB
.)b(
tf([numerator],[denominator])
coefficients
:For example
=G(s)
:for example
=G(s)
In Matlab: G=zpk([3,4],[0,-2,-10,-15],100)
tf(G)
IN MATLAB
Method(3): state Space representation (SS)
for example: State Space to Transfer Function
:Matlab Function
ss2tf(A,B,C,D)=]n,d[
mySys=tf(n,d)
IN MATLAB
;D=0
EXERCISE
Find the transfer function of the system with state space representation
ANSWER
;A=[1 0; -2 1] >>
;B=[1;0]>>
;C=[3 -2]>>
;D=0>>
ss2tf(A,B,C,D)=]n,d[>>
T=tf(n,d)>>
The T.F of this form
=G(s)
:In MATLAB
num=[1 1]
den=conv([1 1 2 1],[1 2])
tf(num,den)
FINDING ZEROS & POLES
:Finding zeros and poles of the T.F
:Poles are the roots for the denominator of transfer functions
:In MATLAB
pole(T.F) for finding poles
zero(T.F) for finding zeros
:In MATLAB
pzmap(T.F)
:Exercise
In MATLAB, find and plot the zeros and poles for the
:following transfer function
=G(s)
Answer
:In MATLAB
;n=[1 2 1] >>
;d=[4 1 2 1] >>
T=tf(n,d) >>
z= zero(T) >>
p=pole(T) >>
pzmap(T) >>
3D Plot
”MATLAB Function: “plot3(x,y,z)
;x=linspace(0,2*pi,20) >>
;y=sin(x) >>
;z=x >>
plot3(x,y,z,’linewidth’,3) >>
xlabel(‘x-axis’) >>
ylabel(‘y-axis’) >>
zlabel(‘z-axis’) >>
title(‘3D-plotting’) >>
3D Plot
Bar Graph
;y=[4 3 2; 3 2 4; 8 5 3; 9 3 1] >>
;bar(y) >>
Or >>bar3(y)
Bar Graph: bar(y)
Bar Graph: bar3(y)
Control Plot
Simulation of Linear systems to different inputs
You can simulate the LTI systems to inputs like impulse, step and other
standard inputs and see the plot of the response in the figure window.
MATLAB command ‘impulse’ calculates the unit impulse response of the
.system, ‘step’ calculates the unit step response of the system
:To obtain an impulse response
Blocks
:There are several general classes of blocks within the Simulink library
Sources: used to generate various signals
Sinks: used to output or display signals
Continuous: continuous-time system elements (transfer functions, state-
space models, PID controllers, etc.)
Discrete: linear, discrete-time system elements (discrete transfer functions,
discrete state-space models, etc.)
Math Operations: contains many common math operations (gain, sum,
product, absolute value, etc.)
Ports & Subsystems: contains useful blocks to build a system
The block shown below has an unused input terminal on the left and an unused output
. terminal on the right
The simple model consists of three blocks: Step, Transfer Function, and
Scope. The Step is a Source block from which a step input signal
originates. This signal is transferred through the line in the direction
indicated by the arrow to the Transfer Function continuous block. The
Transfer Function block modifies its input signal and outputs a new signal
on a line to the Scope. The Scope is a Sink block used to display a signal
much like an oscilloscope.
Modifying Blocks
Find the T.F, zeros, poles and then plot the zeros, poles using
Matlab command and then plot impulse response using Simulink
:for the following system
10
X(s) + Em Y(s)
- 𝑠+ 4
20
The End