You are on page 1of 48

F E AR OF T HE L OR D I S T HE B E GI NNI NG OF

WI S DOM
CONTROL SYSTEM
ANALYSIS USING MATLAB
By

Mr. Anish Benny
Asst. Professor
CONTROL SYSTEM
The study and design of automatic Control Systems
is a vast field.
Control systems, and control engineering
techniques have become a ubiquitous part of
modern technical society.
From devices as simple as a toaster, to complex
machines like space shuttles and rockets, control
engineering is a part of our everyday life.
MATLAB is an aid to design and analyze various
control system using control system toolbox.
KITES - 2014, RIT PAMPADY
CONTROL SYSTEM
A control system is an interconnection of
components forming a system configuration to
provide a desired system response
Aircraft autopilot
Disk drive read-write head positioning system
Robot arm control system
Automobile cruise control system etc.
KITES - 2014, RIT PAMPADY
Basic Control System Components

Plant (or Process)
- The portion of the system to be controlled


Process
Process
Input
Output
Actuator

An actuator is a device that provides the
motive power to the process (i.e., a device
that causes the process to provide the
output).

Sensor:- Sensors are the inputs to the system

Controller:- Controller will provide
necessary control signals to the actuator

Open-Loop Control Systems

An open-loop control system utilizes an actuating device
to control the process directly without using feedback.
Actuating Device Process
Input
Output
Property:
The system outputs have no effect upon the signals
entering the process. That is, the control inputs are not
influenced by the process outputs.
Closed Loop (Feedback) Control Systems

A closed-loop control system uses a measurement of the
output and feedback of this signal to compare it with the
desired input (i.e., reference or command).
Comparison
Comparison Controller Plant
Measurement
Desired Output
Response
Output
Closed-loop: General Form
Input
CONCEPT OF A SYSTEM
KITES - 2014, RIT PAMPADY
SIMPLE CONTROL SYSTEM
Figure shows the feedback control system model

KITES - 2014, RIT PAMPADY
ROOM TEMPERATURE CONTROL
SYSTEM
KITES - 2014, RIT PAMPADY
CONTROL SYSTEM MODELLING
Time domain modeling is done on the system to get
the mathematical equation of the system.
Time domain model is the foundation of State
Space (SS) approach.
By applying a frequency domain transformation on
the above time domain model will result in Transfer
Function (TF) of the system.
By using the model (SS or TF) of a system we can
analyze the system for its stability and other
properties.

KITES - 2014, RIT PAMPADY
EXAMPLE CIRCUIT MODELING
KITES - 2014, RIT PAMPADY
Find the model of the system? Take v1(t) as input
and v2(t) as the output.



Solution
EXAMPLE CIRCUIT MODELING
Find the model of the system? Take v1(t) as input
and v2(t) as the output.



Solution

KITES - 2014, RIT PAMPADY
TRANSFER FUNCTION OF THE MODEL
Case 1
By applying Laplace transform we get,
RCSV
2
(s)+V
2
(s) = V
1
(s)
Output/Input = V
2
(s)/ V
1
(s) = 1/(SRC + 1)

Case 2
By applying Laplace transform we get,
LCS
2
V
2
(s)+RCSV
2
(s)+V
2
(s) = V
1
(s)
Output/Input = V
2
(s)/ V
1
(s) = 1/(S
2
LC + SRC + 1)
KITES - 2014, RIT PAMPADY
STATE SPACE OF THE MODEL
Case 1
Take

Equations are

KITES - 2014, RIT PAMPADY
.
2
2 1 1 1 2
, , Input and output
dv
v x x u v y v
dt
= = = =
.
1
1
1
+
x u
x
RC RC
y x
=
=
| | | | | |
.
.
1 1
1

1 1
1 0
In matrix form
x x u
RC RC
y x u
( ( (
= +
( ( (

= +
STATE SPACE OF THE MODEL
Case 2
Take
Equations are

KITES - 2014, RIT PAMPADY
2
. .
2 2
2 1 1 2 2 1 2
2
, = , , Input and output
dv d v
v x x x x u v y v
dt dt
= = = = =
. .
1 1 2 2 1 2
1
1 1
0 + and
R
x x x x x x u
LC L LC
y x
= = +
=
| | | | | |
.
.
1 1
.
2 2
1
2

0 1 0
1 1
1 0 0
In matrix form
x x
u
R
x x
LC L LC
x
y u
x
( ( ( (
( ( ( (
= +
( ( ( (


(
(
= +
(

MATLAB COMMANDS
ss - Specify state-space models or convert LTI model to state
space
tf - Create or convert to transfer function model
zpk - Create or convert to zero-pole-gain model
bodeplot - Plot Bode frequency response and return plot
handle
impulseplot - Plot impulse response and return plot handle
nicholsplot - Plot Nichols frequency responses and return plot
handle
nyquistplot - Plot Nyquist frequency responses and return plot
handle
KITES - 2014, RIT PAMPADY
pzplot - Plot pole-zero map of LTI model and return plot
handle
rlocusplot - Plot root locus and return plot handle
stepplot - Plot step response of LTI systems and return plot
handle
ctrb - Controllability matrix
obsv - Observability matrix
acker - Pole placement design for single-input systems
place - Pole placement design
rlocus - Evans root locus
KITES - 2014, RIT PAMPADY
MATLAB COMMANDS
allmargin - All crossover frequencies and corresponding
stability margins
bode - Bode diagram of frequency response
bodemag - Bode magnitude response of LTI models
evalfr - Evaluate frequency response at given frequency
freqresp - Evaluate frequency response over frequency grid
frd - Create or convert to frequency-response data models
margin - Gain and phase margins and associated crossover
frequencies
nichols - Nichols plot of LTI models
nyquist - Nyquist plot of LTI models
impulse - Impulse response of LTI model
step - Step response of LTI systems

KITES - 2014, RIT PAMPADY
MATLAB COMMANDS
MATLAB COMMANDS
bandwidth - Frequency response bandwidth
lti/order - LTI model order
pole - Compute poles of LTI system
zero - Transmission zeros of LTI model
pzmap - Compute pole-zero map of LTI models
ss2tf - Convert state-space filter parameters to transfer
function form
tf2ss - Convert transfer function filter parameters to state-
space form
feedback - Feedback connection of two LTI models
KITES - 2014, RIT PAMPADY
CONTINUOUS TIME SYSTEM ANALYSIS
Transfer Function Representation
Time Simulations
Frequency Response Plots
Control Design
State Space Representation
TRANSFER FUNCTION
REPRESENTATION
Tf2zp
Zp2tf
Feedback
Parallel
series

CONT
Transfer functions are defined in MATLAB by storing
the coefficients of the numerator and the
denominator in vectors. Given a continuous-time
transfer function
B(s)
H(s) = ---------
A(s)
CONT
Where B(s) = b
M
s
M
+b
M-1
s
M-1
++b
0
and A(s) = a
N
s
N
+a
N-1
s
N-1
++a
0

Store the coefficients of B(s) and A(s) in the vectors
num = [b
M
b
M-1
b
0
]
den = [a
N
a
N-1
a
0
]

EXAMPLE
5s+6
H(s) = ----------------
s
3
+10s
2
+5
num = [5 6];
den = [1 10 0 5];

all coefficients must be included in the vector, even
zero coefficients
CONT
To find the zeros, poles and gain of a transfer
function from the vectors num and den which
contain the coefficients of the numerator and
denominator polynomials:
[z,p,k] = tf2zp(num,den)

EXAMPLE
num = [5 6];
den = [1 10 0 5];
[z,p,k] = tf2zp(num,den)

z = -1.2000
p = -10.0495 0.0248+0.7049i 0.0248-0.7049i
k = 5
EXAMPLE CONT
(s-z
1
)(s-z
2
)...(s-z
n
)
H(s) = K --------------------------
(s-p
1
)(s-p
2
)...(s-p
n
)

5*(s+1.2)
----------------------------------------------------------
(s+10.0495)(s-{0.0248+0.7049i})(s-{0.0248-0.7049i})

CONT
To find the numerator and denominator
polynomials from z, p, and k:
[num,den] = zp2tf(z,p,k)
To reduce the general feedback system
to a single transfer function:
T(s) = G(s)/(1+G(s)H(s))
[numT,denT]=feedback(numG,denG,numH,denH);
CONT
To reduce the series system to a single transfer function,
T(s) = G(s)H(s)
[numT,denT] = series(numG,denG,numH,denH);
To reduce the parallel system to a single transfer
function, T(s) = G(s) + H(s)
[numT,denT] = parallel(numG,denG,numH,denH);


TIME SIMULATIONS
residue
Step
Impulse
lsim
CONT
[R,P,K] = residue (B,A) finds the residues, poles and
direct term of a partial fraction expansion of the
ratio of two polynomials B(s)/A(s)
The residues are stored in r, the corresponding poles
are stored in p, and the gain is stored in k.
EXAMPLE
If the ratio of two polynomials is expressed as
b(s) 5s
3
+3s
2
-2s+7
------- = -------------------
a(s) -4s
3
+8s+3

b = [ 5 3 -2 7]
a = [-4 0 8 3]
EXAMPLE CONT
r = -1.4167 -0.6653 1.3320
p = 1.5737 -1.1644 -0.4093
k = -1.2500

B(s) R(1) R(2) R(n)
------ = -------- + --------- + ... + --------- + K(s)
A(s) s - P(1) s - P(2) s - P(n)
FIND THE RESPONSE OF A SYSTEM TO A
PARTICULAR INPUT
First store the numerator and denominator of the
transfer function in num and den, respectively.
To plot the step response:
step(num,den)
To plot the impulse response:
impulse(num,den)
CONT
For the response to an arbitrary input, use the
command lsim (linear simulation)
Create a vector t which contains the time values in
seconds
t = a:b:c;
Define the input x as a function of time, for
example, a ramp is defined as x = t
lsim(num,den,x,t);


FREQUENCY RESPONSE PLOTS
Freqs
Bode
Logspace
Log10
Semilogx
CONT
To compute the frequency response H of a transfer
function, store the numerator and denominator of
the transfer function in the vectors num and den.
Define a vector w that contains the frequencies for
which H) is to be computed, for example w = a:b:c
where a is the lowest frequency, c is the highest
frequency and b is the increment in frequency.
H = freqs(num,den,w)


CONT
To draw a Bode plot of a transfer function which has
been stored in the vectors num and den:
bode(num,den)

CONT
To customize the plot, first define the vector w which
contains the frequencies at which the Bode plot will be
calculated.
Since w should be defined on a log scale, the command
logspace is used.
For example, to make a Bode plot ranging in
frequencies from 0.1 to 100, define w by
w = logspace(-1,2);
The magnitude and phase information for the Bode plot
can then be found by:
[mag,phase] = bode(num,den,w);

CONT
To plot the magnitude in decibels, convert mag
using the following command:
magdb = 20*log10(mag);
To plot the results on a semilog scale where the y-
axis is linear and the x-axis is logarithmic:
semilogx(w,magdb)
For the log-magnitude plot :
semilogx(w,phase)

CONTROL DESIGN
Rlocus

Consider a feedback loop where G(s)H(s) = KP(s)
and K is a gain and P(s) contains the poles and
zeros of the controller and of the plant.
Suppose that the numerator and denominator
coefficients of P(s) are stored in the vectors num
and den.
rlocus(num,den)



STATE SPACE REPRESENTATION
Ss
Step
Lsim
Ss2tf
Tf2ss
ss2ss
VERY SHORT SIMULINK TUTORIAL
In the Matlab command window write simulink.
The window that has opened is the Simulink Library
Browser.
It is used to choose various Simulink modules to use in your
simulation.
From this window, choose the File menu, and then New
(Model).
Now we have a blank window, in which we will build our model.
This blank window and the library browser window, will be the
windows well work with.
We choose components from the library browser, and
then drag them to our work window.
Well use only the Simulink library (also called toolbox) for now.
KITES - 2014, RIT PAMPADY
SIMULINK TUTORIAL
As we can see, the Simulink library is divided into several
categories:
1. Continuous Provides functions for continuous
time, such as integration, derivative, etc.
2. Discrete Provides functions for discrete time.
3. Functions & Tables Just what the name says.
4. Math Simple math functions.
5. Nonlinear Several non-linear functions, such as
switches, limiters, etc.
6. Signals & Systems Components that work
with signals.
7. Sinks Components that handle the outputs of the
system (e.g. display it on the screen).
8. Sources Components that generate source signals
for the system.
KITES - 2014, RIT PAMPADY
EXAMPLE OF SIMULINK
KITES - 2014, RIT PAMPADY
EXAMPLE OF SIMULINK
KITES - 2014, RIT PAMPADY
EXAMPLE OF SIMULINK
KITES - 2014, RIT PAMPADY