Uploaded by Saad Rashid

LCS Manual spring 2018

advertisement
Instructor’s Manual
ES425
Linear Control Systems
B. E. Electrical Engineering
Department of Electrical Engineering
Hamdard Institute of Engineering and Technology
Hamdard University Islamabad Campus
Lab Manual: Control System
Page 1
Revision History
First Edition:
2003
Second Edition:
2008
Third Edition:
2016
Fourth Edition:
2017
Fifth Edition: 2018
Lab Manual: Control System
Page 2
S#
Title of Experiment
1
To RECOGNIZE with MATLAB Window Environment
2
To OBSERVE the Analysis and Design of Control Systems using Control System and
Symbolic math Toolbox
3
To RECOGNIZE with SIMULINK Environment
4
To OBSERVE Time Response Characteristics Of Control Systems And Finding Overshoot,
Peak Time, Rise Time and Setting Time
5
To PERCEIEVE State Space Model Transformation with MATLAB
6
To DEMONSTRATE control system using root locus technique
7
To PRODUCE Effect of zero on 2nd order system response, pole zero cancellation
8
To Observe the Designing of Control Systems using MATLAB’s SISO Design Tool.
(Open Ended Lab)
9
To illustrate the Analysis of different control system configurations on PID Controller
Trainer IT-4406.
10
11
12
13
14
To illustrate the Analysis of different types of controller on PID Controller Trainer IT4406.
To illustrate the Analysis of Proportional + Integrator + Derivative (PID) controller on
PID Controller Trainer
IT-4406.
To illustrate the Analysis of Proportional + Integrator + Derivative (PID) controller with
first-order and Secondorder systems on PID Controller Trainer IT-4406.
(Open Ended Lab)
To DEMONSTRATE Controllability & Observability properties of control system in state
space
To illustrate the Frequency Response Characteristics of Control Systems.
Lab Manual: Control System
Page 3
Lab # 01
To Recognize with MATLAB Window
Environment
Objective:
By the end of this laboratory assignment, students should be able to:







Use MATLAB to perform different basic operation of mathematics.
Perform all matrices operations.
Generate and plot signals and complex valued functions.
Confidently develop MATLAB M Files and save results of computations from a MATLAB
Session.
Overview of MATLAB:
MATLAB is a high-performance language for technical computing. It integrates computation,
visualization, and programming in an easy-to-use environment where problems and solutions are
expressed in familiar mathematical notation. Typical uses include:






Math and computation
Algorithm development
Modeling, simulation, and prototyping
Data analysis, exploration, and visualization
Scientific and engineering graphics
Application development, including Graphical User Interface building
MATLAB is an interactive system whose basic data element is an array that does not require
dimensioning. This allows you to solve many technical computing problems, especially those with matrix
and vector formulations, in a fraction of the time it would take to write a program in a scalar noninteractive language such as C or Fortran.
The name MATLAB stands for matrix laboratory. MATLAB was originally written to provide easy
access to matrix software developed by the LINPACK and EISPACK projects, which together represent
the state-of-the-art in software for matrix computation.
MATLAB has evolved over a period of years with input from many users. In university environments, it
is the standard instructional tool for introductory and advanced courses in mathematics, engineering, and
science. In industry, MATLAB is the tool of choice for high-productivity research, development, and
analysis.
Lab Manual: Control System
Page 4
MATLAB features a family of application-specific solutions called toolboxes. Very important to most
users of MATLAB, toolboxes allow you to learn and apply specialized technology. Toolboxes are
comprehensive collections of MATLAB functions (M-files) that extend the MATLAB environment to
solve particular classes of problems. Areas in which toolboxes are available include signal processing,
control systems, neural networks, fuzzy logic, wavelets, simulation, and many others.
Equipment/Apparatus



MATLAB Software
Pentium-IV PC
AC Power Supply
Procedure
Command Window
Working with Command Window allows the user to use MATLAB as a versatile scientific
calculator for doing online quick computing. Input information to be processed by the
MATLAB commands can be entered in the form of numbers and arrays.
As an example of a simple interactive calculation, suppose that you want to calculate the torque
(T) acting on 0.1 kg mass (m) at 30o swing θ of the pendulum of length ( l ) 0.2 m. For small
values of swing, T is given by the formula mglθ. This can be done in the MATLAB command
window by typing:
>>torque=0.1*9.8*0.2*pi/6
MATLAB responds to this command by:
torque =
0.1026
MATLAB calculates and stores the answer in a variable torque (in fact, a 1x1 array) as soon
as the Enter key is pressed. The variable torque can be used in further calculations. π is
predefined in MATLAB; so we can just use pi without declaring it to be 3.14….
If any statement is followed by a semicolon,
>> m=0.1;
>> l=0.2;
>> g=9.8;
Lab Manual: Control System
Page 5
The display of the result is suppressed. The assignment of the variable has been carried out
even though the display is suppressed by the semicolon. To view the assignment of a variable,
simply type the variable name and hit Enter. For example:
>> torque=0.1*9.8*0.2*pi/6;
>> torque (Enter)
torque =
0.1026
+ addition, - subtraction, * multiplication, / division, and ^ power are usual arithmetic
operators.
+
The basic MATLAB trigonometric commands are sin, cos, tan, cot, sec and csc. The
inversessin−1(𝑥), cos−1(𝑥) etc., are calculated by asin, acos, etc. The same is true for
hyperbolic functions.
Variables j =√-1 and i = √-1 are predefined in MATLAB and are used to represent
complex numbers.
MATLAB representation of complex numberz=σ+jω
z=σ+j*ω or z=σ+ωj
The later case is always interpreted as a complex number, whereas, the former case is a complex
number in MATLAB only if j has not been assigned any prior local value.
z=rejϴ
MATLAB representation of complex number
z=r*exp(j*ϴ)or z=r*exp(ϴj)
z=r*(cos 𝛳+j*sin 𝛳) or
z=r*(cos 𝛳+sin 𝛳 ∗ 𝑗)
In Cartesian form, arithmetic additions on complex numbers are as simple as with real
numbers. Consider two complex numbersz1=σ1+jω1 andz2=σ2+jω2. Their sum z=z1+z2.
For example, two complex numbers 3+4j and z=1.8+2j can be added in MATLAB as:
Multiplication of two or more complex numbers is easier in polar/complex exponential form.
Lab Manual: Control System
Page 6
Two complex numbers with radial lengths r1=2 and r2=2.5 are given with anglesϴ1=35 and ϴ2=П/4 rad.
We change ϴ1 to radians to give
The complex exponential form of their product z=z1z2 is given by
This can be done in MATLAB by:
Magnitude and phase of a complex number can be calculated in MATLAB by commands abs and angle.
The following MATLAB session shows the magnitude and phase calculation of complex numbers.
z=5ej0.19П and z=1/2+√3j
Lab Manual: Control System
Page 7
The mathematical quantities ex, log(x) and ln(x) are calculated with exp (x), log10(x), and log(x),
respectively.
Elementary Matrices
Basic data element of MATLAB is a matrix that does not require dimensioning. To create the matrix
variable in MATLAB workspace, type the statement (note that any operation that assigns a value to a
variable, creates the variable, or overwrites its current value if it already exists).
The blank spaces (or commas) around the elements of the matrix rows separate the elements. Semicolons
separate the rows. For the above statement, MATLAB responds with the display
Vectors are special class of matrices with a single row or column. To create a column vector variable in
MATLAB workspace, type the statement
To enter a row vector, separate the elements by a space or comma ' , '. For example:
We can determine the size of the matrices (number of rows, number of columns) by using the size
command.
Lab Manual: Control System
Page 8
For vectors, length command can be used to determine its number of elements.
The use of colon ( : ) operator plays an important role in MATLAB. This operator may be used to
generate a row vector containing the numbers from a given starting value xi, to the final value xf, with a
specified increment dx, e.g., x=[xi:dx:xf]
By default, the increment is taken as unity
.To generate linearly equally spaced samples between x1 and x2, use the command linspace(x1,x2) . By
default, 100 samples will be generated. The command linspace (x1,x2,N) allows the control over number
of samples to be generated. See the example below.
The colon operator can also be used to subscript matrices. For example, A(:,j) is the jth column of A, and
A(i,:) is the ith row of A. Observe the following MATLAB session.
Lab Manual: Control System
Page 9
Manipulating matrices is almost as easy as creating them. Try the following operations:
When you add/subtract/multiply/divide a vector/matrix by a number (or by a variable with a number
assigned to it), MATLAB assumes that all elements of vector/matrix should be individually operated on.
Given Table provides the list of basic operations on any two arbitrary matrices A and B and their
dimensional requirements.
Lab Manual: Control System
Page 10
To find the solution of the following set of linear equations:
Following MATLAB commands solve the given set of simultaneous linear equations.
Plotting
MATLAB is an outstanding tool for visualization. In the following, we will learn how to create and print
simple plots.
We are going to plot sinusoidal oscillations with exponential decay. To do this, first generate the data (xand y- coordinates). x-coordinate in this case is time steps. Let the initial time t0=0sec and final time tf=10
sec with an interval of 0.05 sec. y- coordinate is the value of sinusoidal oscillations represented by y(t)=et/2
sin(2Пt)
This plot can be generated by by entering the following commands.
Lab Manual: Control System
Page 11
Fig.1.1 Plotting sinusoid with exponential decay.
Lab Manual: Control System
Page 12
Fig 1.2 Plotting multiple plots in a single figure window.
The command subplot (m,n,p) breaks the figure window into an m-by-n matrix of small axes and selects
the pth axes for the current plot. Labeling, title, and grid commands should be given immediately after the
particular subplot command to apply them to that subplot.
Discussion on Results:
Conclusion:
Lab Manual: Control System
Page 13
Lab Tasks/ Activities
1.
2.
3.
4.
5.
Lab Manual: Control System
Page 14
Lab # 02
To observe the analysis and design of Control
Systems using Control System and Symbolic
Math Toolbox
Objective



Brief introduction to Symbolic Math toolbox.
Commands to carryout block diagram manipulations.
Commands which enable us to find out the solution of all complex feedback systems

Theory Overview
Control System Toolbox is a collection of commands to be used for control systems analysis and design.
Only some of these commands are used, because of the limited nature of course profile. Description of
these commands will be distributed in different labs. In this lab, commands related to transfer functions
are presented.
To see all the commands in the Control System Toolbox and their functionalities, types help control in
the MATLAB command window. In this lab, how to represent transfer functions inthe MATLAB, partial
fraction expansion of rational expressions, and representation of transfer functions as LTI objects will be
learned:
roots –Find polynomial roots
poly –Convert roots to polynomial
polyval –Evaluate polynomial value
conv –Convolution and polynomial multiplication
deconv –Deconvolution and polynomial division
residue –Partial-fraction expansion (residues)
tf –Creation of transfer functions or conversion to transfer functions
pole –Compute the poles of LTI models zero –Transmission zeros of
LTI systems
tfdata –Quick access to transfer function data
zpkdata –Quick access to zero-pole-gain data
pzmap –Pole-zero map of LTI models
zpk –Create zero-pole-gain models or convert to zero-pole-gain format
Equipment/Apparatus



MATLAB Software
Pentium-IV PC
AC Power Supply
Lab Manual: Control System
Page 15
Procedure

1) Polynomials
Consider a polynomial ‘s3 + 3s2 + 4’, to which we attach the variable name p. MATLAB, can interpret a
vector of length n +1 as the coefficients of an nth -order polynomial. Coefficients of the polynomial are
interpreted in descending powers. Thus, if the polynomial is missing any coefficient, we must enter zeros
in the appropriate places in the vector. For example, polynomial p can be represented by the vector [1 3 0
4] in MATLAB. For example:

Roots of the polynomial can be obtained by roots command.
Given roots of a polynomial in a vector, a vector of polynomial coefficients can be obtained by the
command poly.
Use the command polyval(p,s) to evaluate the polynomial represented by vector p at arbitrary value
of s. For example, to evaluate the polynomial ‘s3+3s2+4’ at s=√2, type
Lab Manual: Control System
Page 16
The product of two polynomials is found by taking the convolution of their coefficients. The function
conv will do this for us. Consider an example of multiplying polynomial ‘s2+3s+4’with ‘s+2’
The function deconv divides two polynomials and returns quotient as well as the remainder polynomial.
where q is the quotient and r is the remainder polynomial.
2) Transfer Functions:
Transfer functions can be represented in MATLAB as LTI (Linear Time Invariant) objects using
numerator and denominator polynomials. Consider the transfer function given by
It can be represented in MATLAB as:
Lab Manual: Control System
Page 17
The function conv has been used to multiply polynomials in the following MATLAB session for the
transfer function
Transfer functions can also be entered directly in polynomial form as we enter them in the notebook using
LTI objects. For example, observe the following MATLAB session.
Lab Manual: Control System
Page 18
The commands pole and zero calculate the poles and zeros of LTI models.
If we know zeros and poles of the system with gain constant, the transfer function of LTI system can be
constructed by zpk command. For example, to create a unity gain transfer function G3(s) with zero at -1
and two poles at -2.618 and -0.382, follow the MATLAB session given below.
The polynomial transfer function created with tf can be converted to zero-pole-gain model by the
command zpk and vice versa. The following MATLAB session gives the zero-pole-gain format of LTI
system represented by G(s).
Lab Manual: Control System
Page 19
The function pzmap(G) plots the poles and zeros of the transfer function G(s) on complex plane. When
used with two left hand side arguments, [p,z] = pzmap(G), the function returns the poles and zeros of the
system in two column vectors p and z. For example:
Transfer Function Manipulation (Block Diagram Manipulation)
Suppose we have developed mathematical models in the form of transfer functions for the plant,
represented by G(s), and the controller, represented by D(s), and possibly many other system components
such as sensors and actuators. Our objective is to interconnect these components to form block diagram
representation of a feedback control system. MATLAB offers several functions to carry out block
diagram manipulations.
Two methods are available:
1. Solution via series, parallel, and feedback commands:
series(G,D) for a cascade connection ofG(s) andD(s); parallel(G1,G2) for a parallelconnection of G1(s)
and G2(s); feedback(G,H, sign) for a closed-loop connection with G(s) in the forward path and H(s) in
the feedback path; and sign is -1 for negative feedback or +1 for positive feedback (the sign is optional
for negative feedback); and cloop(G,sign) for a unity feedback system with G(s) in the forward path, and
sign is -1 for negative feedback or +1 for positive feedback (the sign is optional for negative feedback).
2. Solution via algebraic operations:
G*D for a cascade connection ofG(s) andD(s); G1+G2 for a parallel connection ofG1(s)and G2(s);
G/(1+G*H) for a closed-loop negative feedback connection with G(s) in the forward path and H(s) in the
feedback path; and G/(1-G*H) for positive feedback systems.
Series Command:
SYS = SERIES (SYS1, SYS2, OUTPUTS1, INPUTS2) connects two LTI models
SYS1 and SYS2 in series such that the outputs of SYS1 specified by OUTPUTS1 are connected to the
inputs of SYS2 specified by INPUTS2. The vectors OUTPUTS1 and INPUTS2 contain indices into the
outputs and inputs of SYS1 and SYS2, respectively.
Lab Manual: Control System
Page 20
For example:
Use [num, den] = series (num1,den1,num2,den2) and G=series(G1,G2) to evaluate the overall transfer
function of the following system.
G1=1/500s2& G2=(s+1)/(s+2)
Fig.01 Open Loop System
MATLAB code by using [num,den]=series(num1,den1,num2,den2) :
num1=[0 0 1];
%Define numerator of G1
den1=[500 0 0];
%Define denominator of G1
num2=[0 1 1];
%Define numerator of G2
den2=[0 1 2];
%Define denominator of G2
[num,den]=series(num1,den1,num2,den2)
%Obtaining numerator & denominator of overall
system
G=tf(num,den)
%Create transfer function G of cascaded systems (G1 & G2)
Result:
num =
0
0 0
1 1
den =
0
500
1000
0
0
Transfer function:
s+1
-----------------500 s^3 + 1000 s^2
Lab Manual: Control System
Page 21
MATLAB code by using G=series(G1,G2) :
G1=tf([0 0 1],[500 0 0]);
%Create transfer function G1(s).
G2=tf([0 1 1],[0 1 2]);
%Create transfer function G2(s).
G=series(G1, G2)
%Calculate product of G1(s) & G2(s).
Result:
Transfer function:
s+1
---------------500 s^3 + 1000 s^2
Parallel Command:
SYS = PARALLEL (SYS1, SYS2, IN1, IN2, OUT1, OUT2) connects the two LTI models SYS1 and
SYS2 in parallel such that the inputs specified by IN1 and IN2 are connected and the outputs specified by
OUT1 and OUT2 are summed.
For example:
Use [num,den] = parallel(num1,den1,num2,den2) and G=parallel(G1,G2) to evaluate the overall transfer
function of the following system.
G1=1/500s2& G2=(s+1)/(s+2)
Fig. 3.2 Block Diagram of Cascaded system
MATLAB code by using [num, den]=parallel(num1,den1,num2,den2) :
num1= [0 0 1];
%Define numerator of G1
den1=[500 0 0];
%Define denominator of G1
num2=[0 1 1];
%Define numerator of G2
Lab Manual: Control System
Page 22
den2=[0 1 2];
%Define denominator of G2
[num, den]=parallel (num1, den1, num2, den2) %Obtaining numerator & denominator of
overall system
G=tf (num, den)
%Create transfer function G of parallel systems (G1 & G2)
Result:
num =
0 500 500
1
2
den =
0
500
1000
0
0
Transfer function:
500 s^3 + 500 s^2 + s + 2
----------------------500 s^3 + 1000 s^2
MATLAB code by using G=parallel(G1,G2) :
G1=tf([0 0 1],[500 0 0]);
%Create transfer function G1(s).
G2=tf([0 1 1],[0 1 2]);
%Create transfer function G2(s).
G=parallel(G1,G2)
%Calculate summation of G1(s) & G2(s).
Result:
Transfer function:
500 s^3 + 500 s^2 + s + 2
------------------------500 s^3 + 1000 s^2
Lab Manual: Control System
Page 23
Feedback Command:
SYS = FEEDBACK (SYS1, SYS2) computes an LTI model SYS for the closed-loop feedback system.
Negative feedback is assumed. To apply positive feedback, use the syntax SYS = FEEDBACK (SYS1,
SYS2, +1).
For example:
Use feedback () to obtain negative feedback and positive feedback of given system.
G1=1/500s2& H=(s+1)/(s+2)
Fig 3.3 Block Diagram of closed loop system
MATLAB code for negative feedback by using G=feedback (G1,H) or
G=feedback(G1,H,-1) :
G1=tf ([0 0 1],[500 0 0]); %Create transfer function G1(s).
H=tf ([0 1 1],[0 1 2]); %Create transfer function H(s).
G=feedback (G1,H) %Calculate transfer function of negative feedback system
Transfer function:
s+2
-------------------------500 s^3 + 1000 s^2 + s + 1
G1=tf ([0 0 1] , [500 0 0]); %Create transfer function G1(s).
H=tf ([0 1 1], [0 1 2]); %Create transfer function H(s).
G=feedback(G1, H,-1) %Calculate transfer function of negative feedback system.
Result:
Transfer function:
s+2
-------------------------500 s^3 + 1000 s^2 + s + 1
Lab Manual: Control System
Page 24
MATLAB code for positive feedback by using G=feedback (G1,H, +1) :
G1=tf ([0 0 1],[500 0 0]); %Create transfer function G1(s).
H=tf ([0 1 1],[0 1 2]); %Create transfer function H(s).
G=feedback (G1, H, +1) %Calculate transfer function of positive feedback system.
Result:
Transfer function:
s+2
-------------------------500 s^3 + 1000 s^2 - s – 1
Lab Activity:
1. Use MATLAB to find a single transfer function T(s) =C(s)/R(s) of given system.
Find the solution via series, parallel and feedback commands
2. Use MATLAB to find a single transfer function G(s) =C(s)/R(s) of given system.
Find the solution via series, parallel and feedback commands.
3. Find zeros and poles using (tf2zpk) of transfer function
Lab Manual: Control System
Page 25
4. Find transfer function using (zp2tf) from zero, pole and gain
Discussion on Results:
Conclusion:
Lab Manual: Control System
Page 26
Lab # 03
To Recognize with SimulinkEnvironment
Objective
After completing this lab, students will be able to




Describe Simulink environment
List some of the commonly used signal sources available in Simulink to provide
stimulus to a model.
List some of the commonly used sink blocks available in Simulink to view the output
of a model.
State how hierarchical designs are created.

Theory Overview
The Simulink model mimics the block diagram of a feedback control system and is used to evaluate the
response of controlled variable to any test input. It also provides the response of any internal variable of
the control system (output variable of a subsystem block) without the need for block diagram reduction.
SIMULINK (Simulation LINK) is an extension of MATLAB for modeling, simulating, and analyzing
dynamic, linear/nonlinear, complex control systems. Graphical User Interface (GUI) and visual
representation of simulation process by simulation block diagrams are two key features which make
SIMULINK one of the most successful software packages, particularly suitable for control system design
and analysis.
Simulation block diagrams are nothing but the same block diagrams we are using to describe control
system structures and signal flow graphs. SIMULINK offers a large variety of ready to use building
blocks to build the mathematical models and system structures in terms of block diagrams. Block
parameters should be supplied by the user. Once the system structure is defined, some additional
simulation parameters must also be set to govern how the numerical computation will be carried out and
how the output data will be displayed.
Equipment/Apparatus



MATLAB Software
Pentium-IV PC
AC Power Supply
Procedure
To start SIMULINK, enter simulink command at the MATLAB prompt. Alternatively one can also click
on SIMULINK icon shown in figure.
Lab Manual: Control System
Page 27
A SIMULINK Library Browser (shown in below) appears which displays tree-structured view
of the SIMULINK block libraries. It contains several nodes; each of these nodes represents a
library of subsystem blocks that is used to construct simulation block diagrams. You can
expand/collapse the tree by clicking on the +/- boxes beside each node and block in the block
set pan.
Fig. 3.2: Simulink Library Browser
Expand the node labeled Simulink. Sub nodes of this node (Commonly Used Blocks,
Continuous, Discontinuities, Discrete, Logic and Bit Operations, etc…) are displayed.Now
for example, expanding the Sources sub node displays a long list of Sources library blocks.
Simply click on any block to learn about its functionality in the description box (see below
Fig).
Lab Manual: Control System
Page 28
Fig. 3.3: Simulink Library Browser
You may now collapse the Sources subnodes, and expand the Sinks subnode. A list of Sinks
library block appears (below fig). Learn the purpose of various blocks in Sinks subnode by
clicking on the blocks.
Fig. 3.4: Simulink Library Sub nodes Blocks
Lab Manual: Control System
Page 29
We are now ready to proceed to the next step, which is the construction of a simulation
diagram. In the SIMULINK library browser, follow File→New→Model or hit Ctrl+N to open
an ‘untitled' workspace (see below Fig) to build up an interconnection of SIMULINK blocks
from the subsystem libraries.
Fig. 3.5: Simulink New model Construction
Simulation of an Equation
In this example we will use simulink to model an equation. Consider the equation given by
x(t)= Acos(wt+ⱷ)
Where the displacement x is a function of time t, frequency w, phase angle, and amplitude A. In this
example the values for these parameters are set as follows: frequency=5 rad/sec; phase=pi/2; A=2.
Lab Manual: Control System
Page 30
Double click on the blocks and enter the appropriate values as prompted by the pop-up dialog windows.
Note that the cosine function can be selected from the pull-down menu in the pop-up window. In the
arrangement shown above, the input signal (a ramp function) is to be displayed along with the output
(displacement) via the use of the mux tool as demonstrated earlier in this tutorial. To view the plots,
double click on the scope.
Make sure all blocks are connected correctly then run the simulation (CTRL+T). You may need to select
the Auto scale button on the scope display window to obtain a better display of the plots.
This example has demonstrated the use Simulink with built-in mathematical functions and other
supporting toolboxes to simulate an equation. The same output/result can also be obtained with the
following set of instructions entered in Matlab command window:
Matlab code of sample equation:
>>t=(0:.01:10);A=2;phi=pi/2;omega=5;
>>xt=A*cos(omega*t+phi);
>> plot(t,xt);grid
Simulink Model of sample equation:
Fig. 3.6: Simulink model of sample equation
Lab Manual: Control System
Page 31
Result:
Fig. 3.7: Result of sample equation
Lab Activity:
1.
Consider a dynamic system consisting of a single output y, and two inputs r and w : Y(s) = G(s)R(s) +
N(s)W(s)
Where
G(s) = 2e-5s/50s2+15s+1 (process)
N(s) = 0.3e-5s/15s+1 (disturbance)
Model the system in SIMULINK.
For r and w both step signals, obtain the system output y. Display the output on scope. Also, using
a SIMULINK block, fetch the output to the workspace.
2.
This problem is to study the effects of Proportional (P), Proportional + Integral (PI), and Proportional +
Derivative (PD) control schemes on the temperature controlsystem. A temperature control system has the
block diagram given in Fig. The input signal is a voltage and represents the desired temperature θr
Simulate the control system using SIMULINK when θr is a unit-step function and when (i) D(s) = 1,
(ii)D(s) = 1+ 0.1/s and D(s) = 1+ 0.3s
Conclusion:
Lab Manual: Control System
Page 32
Lab No.04
To observe the Time Response Characteristics of control systems
and finding overshoot, peak time, rise time and setting time
Objective:
The main objectives of this lab are




Time response characteristics of 2nd order system.
Impulse and step response of 2nd order system.
By using LSim, ramp response of 2nd order system.
Pole zero map of 2nd order system from the given transfer function.
Theory Overview:
Time response characteristics of interest to us in analysis and design of control systems are: rise time (tr),
settling time (ts), peak time (tp) , and peak overshoot (Mp) of step response of a system.
MATLAB has a powerful GUI tool, called LTI Viewer, for obtaining both the time and frequency
response characteristics of a given Linear Time Invariant system. In this module, we give the basic
features of this GUI tool and use it for time response analysis.
LTI Viewer (GUI Tool):
LTIVIEW Opens the LTI Viewer GUI.
LTIVIEW opens an empty LTI Viewer. The LTI Viewer is an interactive graphical user
interface (GUI) for analyzing the time and frequency responses of linear systems and
comparing such systems.
LTIVIEW (SYS1, SYS2,...,SYSN) opens an LTI Viewer containing the step response of the
LTI models SYS1,SYS2,...,SYSN. You can specify a distinctive color, line style, and marker
for each system, as in
sys1 = rss(3,2,2);
sys2 = rss (4,2,2);
ltiview (sys1,'r-*',sys2,'m--');
LTIVIEW (PLOTTYPE,SYS1, SYS2,...,SYSN) further specifies which responses to plot in
the LTI Viewer. PLOTTYPE may be any of the following strings (or a combination thereof):
1) 'step'
Step response
Lab Manual: Control System
Page 33
2) 'impulse'
3) 'bode'
Impulse response
Bode diagram
4) 'bodemag' Bode Magnitude diagram
5) 'nyquist'
Nyquist plot
6) 'nichols'
Nichols plot
7) 'sigma'
Singular value plot
8) 'pzmap'
Pole/Zero map
9) 'iopzmap' I/O Pole/Zero map
For example,
Ltiview ({'step'; 'bode'},sys1,sys2)
opens an LTI Viewer showing the step and Bode responses of the LTI models SYS1 and
SYS2.
Equipment/Apparatus



MATLAB Software
Pentium-IV PC
AC Power Supply

Procedure:
The following summarize the steps may take to obtain plots from the LTI viewer
a. Access the LTI Viewer The LTI viewer, shown in figure may be access by typingltiview
in theMATLAB Command Windowor by executing this command ltiview inan M-file.
b. Create LTI transfer functions Create LTI transfer function for which you want toobtain
responses. The transfer functions can be created in an M-file or in MATLABCommand
Window statements to place the transfer function in the MATLAB workspace. All LTI
objects in the MATLAB workspace can be exported to the LTIviewer.
c. Select LTI transfer functions for the LTI Viewer Choose Import… under the File
menu in the LTI Viewer window and select all LTI objects whose responses you wish to
display in the LTI Viewer sometime during your current session.
d. Select the LTI objects for the next response plot Right-click anywhere in the LTIViewer
plot area to produce a pop-up menu as shown in figure. Under Systems, select or deselect
the objects whose plots you want or do not want to show in the LTI viewer. More than one
LTI transfer function may be selected.
Lab Manual: Control System
Page 34
e. Select the plot type Right-click anywhere in the LTI Viewer plot area to produce a pop-up
menu as shown in figure. Under Plot Type, select the type of plot you want to show in the
LTI Viewer.
f.
Select the characteristics Right-Click anywhere in the LTI viewer plot area to producea
pop-up menu as shown in figure. Under Characteristics select the characteristics (Peak
Response, Settling Time, Rise Time and Steady State) of the plot you wantdisplayed.
More than one characteristic may be selected. For each characteristic chosen, a point will
be displayed on the plot at appropriate location. Read the values of the characteristics by
placing the mouse on the characteristics point on the plot. Left-click the mouse to keep the
values displayed.
Fig. 4.1: LTI View
Example: Use MATLAB’s LTI Viewer and obtains unit-step response, unit-impulseresponse,
pzmap and characteristics (settling time, peak time, rise time and percent overshoot) of the
given transfer function system
G(s) = 25 / s2+4s+25
MATLAB Solution: (M-file)
Lab Manual: Control System
Page 35
%Enter the numerator and denominator of the transfer function
num=[0 0 25];
den=[1 4 25];
%Define the system
sys=tf(num,den);
%Call up LTI viewer- Step Response, Impulse Response & pzmap
ltiview({’step’;’impulse’;’pzmap’},sys)
Fig.4.2: LTI View of G(s)
Note: if you write
ltiview(’step’,sys)
ltiview(‘impulse’,sys)
ltiview(‘pzmap’,sys)
instead of ltiview({‘step’;’impulse’;’pzmap’,sys}) in the M-file
you will get 3 LTI-Viewer windows which given below with characteristics (settling time, peak
time, rise time and percent overshoot).
Lab Manual: Control System
Page 36
Fig.4.3: step and impulse response in LTI View of G(s)
Lab Manual: Control System
Page 37
Fig.4.4: pole-zero map in LTI View of G(s)
Time Response Characteristics in MATLAB window
MATLAB Commands:
1. Step (Step response of Linear Time Invariant (LTI) models)
step (sys) plots the step response of the LTI model SYS (created with either TF,ZPK). For
multi-input models, independent step commands are applied to each input channel.
Example: Obtaining the unit-step response of the transfer function system
G(s) = 25 / s2+4s+25
MATLAB Solution: (M-file)
%Enter the numerator and denominator of the transfer function
num=[0 0 25];
den=[1 4 25];
%Define the system
sys=tf(num,den);
%Obtain the step-response
step(sys)
grid
title(‘Unit-step Response of G(s)=25/s^2+4s+25)’)
xlabel(‘t (sec)’)
ylabel(‘Response’)
Lab Manual: Control System
Page 38
Fig.4.5: Step Response using M-file
2. IMPULSE (Impulse response of LTI models)
impulse(sys) plots the impulse response of the LTI model SYS (created with either TF, ZPK).
For multi-input models, independent impulse commands are applied to each input channel.
Example: Obtaining the unit-impulse response of the transfer function
systemG(s) = 1 / s2+0.2s+1
MATLAB Solution: (M-file)
%Enter the numerator and denominator of the transfer function
num=[0 0 1];
den=[1 0.2 1];
%Define the system
sys=tf(num,den);
%Obtain the impulse-response
impulse(sys)
grid
title(‘Unit-impluse Response of G(s)=1/s^2+0.2s+1)’)
xlabel(‘t (sec)’)
ylabel(‘Response’)
Lab Manual: Control System
Page 39
Fig.4.6: Impulse Response using M-file
LSIM (Simulate time response of LTI models to arbitrary inputs)
lsim(sys,u,t) plots the time response of the LTI model SYS to the input signal
described by u and t. The time vector t consists of regularly spaced time samples and u is a matrix with
as many columns as inputs and whose i-th row specifies the input value at time t(i).
For example,
t = 0:0.01:5;
u = sin(t); lsim(sys,u,t)
simulates the response of a single-input model SYS to the input
u(t)=sin(t) during 5 seconds.
Example: Obtaining the unit-ramp response of the transfer function systemG(s) = 1 /
s2+s+1
MATLAB Solution: (M-file)
%Enter the numerator and denominator of the transfer function
num=[0 0 1];
den=[1 1 1];
%Define the system
sys=tf(num,den);
t=0:0.1:8;
r=t;
y=lsim(sys,r,t);
plot(t,r,’-‘,t,y,’o’)
grid
title(‘Unit-ramp Response of G(s)=1/s^2+1s+1)’)
xlabel(‘t (sec)’)
ylabel(‘Response’)
text(2.1,4.65,’Unit-Ramp Input’)
text(4.5,2.0,’Output’)
Lab Manual: Control System
Page 40
Fig.4.7: Ramp Response using M-file
Lab Activity:
Plot the step responses and plot the poles and zero locations for each of the second order system using LTI
View. State the nature of each response. From plots obtain damping ratio ζ, settling time, peak time, rise
time and percent overshoot using.
2
a. T(s)= 400 / s +12s+400
b. G(s)= 900 / s2+90s+900
c. Y(s)= 225 / s2+30s+225
d. X(s)= 625 / s2+625
Using MATLAB (M-File), obtain the response of system G(s) = s+10 / s3+6s2+9s+10 when the input is
given by r=e(-0.5t).
Using MATLAB (M-File) find the transient response of given feedback system.
Conclusion:
Lab Manual: Control System
Page 41
Lab No. 05
To perceive the State Space Model Transformation with MATLAB
Objective:
After completing this lab, students will be able to



Understand the phenomena of state space representation in MATLAB.

Extract the state space model of any closed loop system from the given set of
equations.

Extract the state space model from the transfer function of the given system.
Theory Overview:
A state-space representation is a mathematical model of a physical system as a set of input, output and
state variables related by first-order differential equations. "State space" refers to the space whose axes
are the state variables. The state of the system can be represented as a vector within that space.
State space modeling of dynamic LTI systems allows the control system designer to bring the vast array
of tools from linear system theory to bear on the design problem.
State-Space Equations:
Where A(t) is called state matrix, B(t) is the input matrix, C(t) the output matrix, and
D(t) the direct transmission matrix.
Key Commands:
Ss - Conversion to state-space
ssdata - Extraction of state-space data from a SYS model
Lab Manual: Control System
Page 42
ss2ss - State transformations
tf2ss -Transfer function to state space models
Equipment/Apparatus:



MATLAB Software
Pentium-IV PC
AC Power Supply
Procedure:
Transformation of Mathematical Models with MATLAB







Q)
Type the program in the MATLAB editor that is in M-file.
Save and run the program.
Give the required inputs in the command window of MATLAB in matrix format.
The command ss2tf(A,B,C,D)) converts the given transfer function into a state model.
The command ss(tf(num,den)) converts the given transfer function into a state model.
The syntax “[A,B,C,D]=zp2ss(z,p,k)” solves zeroes, poles and gain given in the matrix format as
input and gives the output in the form of a state model.
The syntax “[z,p,k]=ss2zp(A,B,C,D)” solves the given state model entered in matrix format as
input and gives the output in the form of poles, zeros and gain.
Here is the following example:
State Space to Transfer Function
A=[1 2;3 4];B=[1;2];C=[1 2];D=[0];
A=[1 2;3 4];
B=[1;2];
C=[1 2];
D=[0];
[num,den]=ss2tf(A,B,C,D);
T=tf(num,den)
[z,p,k]=ss2zp(A,B,C,D)
Lab Manual: Control System
Page 43
Q)Transfer Function to State Space
num=[5 2];den=[1 -5 -2];
num=[0 5 2];
den=[1 -5 -2];
[z,p,k]=tf2zp(num,den);
[A,B,C,D]=tf2ss(num,den);
% [A,B,C,D]=zp2ss(z,p,k)
Lab Manual: Control System
Page 44
Consider the transfer function system
MATLAB will produce matrices A, B, C, and D.
To obtain the transfer function from the state-space equations, use the following command:
iu must be specified for systems with more than one input. For example, if the system has three inputs
(u1, u2, u3), then iu must be either 1, 2, or 3, where 1 implies u1, 2 implies u2, and 3 implies u3.
If the system has only one input, then either
Or
Obtain the transfer function of the system defined by the following state-space equations:
Lab Manual: Control System
Page 45
MATLAB Program:
% Start by clearing everything
clear all
clc
Declare all symbolic variables
Syms k1 k2 b m
Define state space system
A=[0 1 0; -k2/m -b/m b/m; 0 1 -k1/b];
B=[0; 0; 1/m];
C=[1 0 0];
D=0;
Define state transformation matrix and find its inverse
T=[1/2 0 1/2; -1 0 1; 0 1 0;];
Tinv=inv(T)
Tinv =
1.0000
0
1.0000
-0.5000
0
0 1.0000
0.5000
0
Lab Manual: Control System
Page 46
Lab Activity:
1. Obtain a state-space equation and output equation for the system defined by
2. Obtain the transfer function of the system defined by
3. Consider the system defined by
This system involves two inputs and two outputs. Four transfer functions are involved:
Y1(s)/ U1(s), Y2(s)/ U1(s), Y1(s)/ U2(s) & Y2(s)/ U2(s). (When considering input u1, we
assumethat input u2 is zero and vice versa)
Conclusion:
Lab Manual: Control System
Page 47
Lab No. 06
To Demonstrate the Control System Design using Root Locus
Technique
Objective:
i)
ii)
iii)
Plot root locus of given transfer function.
Locate closed loop Poles.
Discuss stability analysis.
Apparatus:
i)
Software: MATLAB 7.12.0.635 (R2011a)
Theory:
Root Locus computes the Evans root locus of a SISO open-loop model. The root locus gives theclosedloop pole trajectories as a function of the feedback gain k (assuming negative feedback).Root loci are
used to study the effects of varying feedback gains on closed-loop pole locations.In turn, these locations
provide indirect information on the time and frequency responses.
rlocus(sys) calculates and plots the rootlocus of the open-loop SISO model sys. This function canbe
applied to any of the following feedback loops by setting sys appropriately.
MATLAB PROGRAM:
num=input(‘enter the numerator of the transfer function’)
den=input(‘enter the denominator of the transfer function’)
h=tf(num,den)
rlocus(h)
PROCEDURE:








Write MATLAB program in the MATLAB specified documents.
Then save the program to run it.
The input is to be mentioned.
The syntax “h=tf(num,den)” gives the transfer function and is represented as h.
The syntax “rlocus(h)” plots the rootlocus of the transfer function h.
Generally the syntax is of the form
rlocus(sys)
rlocus(sys,k)
rlocus(sys1, sys2, ….)
[r,k] = rlocus(sys)
r = rlocus(sys,k)
rlocus(sys) calculates and plots the root locus of the open loop SISO model sys.
Now we have to solve it theoretically.
Lab Manual: Control System
Page 48

Now we have to compare the practical and theoretical outputs to verify each othercorrectly.
Here is the following example:
Q) Transfer function:
1
--------------------(s+1)(s+2)(s+10)
clc
clear all;
close all;
% Task (1)
s=tf('s');
T=1/((s+1)*(s+2)*(s+10))
[r,k] = rlocus(T)
rlocus(T,k);grid on
Lab Manual: Control System
Page 49
Task # 01
Transfer function:
1
----------------s^3 + 6 s^2 + 8 s
Task # 02
Transfer function:
1
------------------------s^4 + 5 s^3 + 8 s^2 + 6 s
Conclusion:
Lab Manual: Control System
Page 50
Lab No. 07
Effect of zero on 2nd order system response, pole
zero cancellation
Objective
To observe the effect of zeros on responses of second order systems in time domain and to analyze
situations in which pole-zero cancellation is possible.
Theory Overview
Consider the second-order system given by
The poles are given by (s = –p1 and s = –p2). When we add a zero at s = –z1 to the controller, the openloop transfer function will change to:
Lab Manual: Control System
Page 51
We can put the zero at three different positions with respect to the pole. The effect of changing the gain K
on the position of closed-loop pole and type of responses.
The zero s = –z1 is not present. This means that we can choose K for the system to be over damped,
critically damped or under damped.
The zero s = –z1 is located to the right of both poles, s = – p2 and s = –p1.In this case, the system can
have only real poles and hence we can only find a value for K to make the system over damped. Hence
time response is low.
The zero s = –z1 is located between s = –p2 and s = –p1.This case provides a root locus on the real axis.
The responses are therefore limited to over damped responses. Fast response is possible.
The zero s = –z1 is located to the left of s = –p2 .By placing the zero to the left of both poles, the vertical
branches of case (a) are bent backward and one end approaches the zero and the other moves to infinity
on the real axis. With this configuration, we can now change the damping ratio and the natural frequency
(to some extent). The closed-loop pole locations can lie further to the left than s = –p2, which will provide
faster time responses.
Equipment/Apparatus



MATLAB Software
Pentium-IV PC
AC Power Supply
Procedure
Stable systems without dead time, which are described by the transfer function
and do not have zeros in the right half
plane, are called minimum phase systems.
If a transfer function has poles and/or zeros in the right half
minimum phase behaviour.
plane then this system shows
Lab Manual: Control System
non-
Page 52
Given below is brief description of new MATLAB functions used in this lab.
ZERO:
>>[z, k]= ZERO (sys)
Wheresys can be transfer function or state space, ‘z’output has zeros vector,‘k’ has zero’s associated gain
vector.
PZMAP:
>> PZMAP(SYS)
where
SYS can be transfer function or state space,
PZ MAP(SYS) computes the poles and (transmission) zeros of the LTI model SYS and plots them in the
complex plane. The poles are plotted as x's and the zeros are plotted as o's.
Addition Of Zero To Closed Loop Transfer Function:
Suppose a zero at s=-z is added to closed loop transfer function, then the resultant transfer function
becomes,
Lab Manual: Control System
Page 53
MATLAB PROGRAM:
addition of zero to closed loop transfer function 1
Lab Manual: Control System
Page 54
Conclusion
Effect of addition of zero to closed loop transfer function
1)
Makes the system overall response faster.
2)
Rise time, peak time, decreases but overshoot increases.
3)
Addition of right half zeros means system response slower and system exhibits inverse
response. Such systems are said to be non-minimum phase systems.
Minimum phase system: The system which doesn’t havezeros in right half of s plane is saidto be
minimum phase system.
Non-minimum phase system: If a transfer function has poles or zeros in right half of s planethen the
system shows the non-minimum phase behavior.
Lab Activity:
Lab Task 1:
For the following transfer function study the effect of additional zeros on the response of second order
system, note down the change in Ts, Tr, %OS, damping ratio, un-damped natural frequency and poles of
the system, let
D=s^2+2s+9
i.
G1(s)=9/D
ii.
G2(s)=((s+3)*9/3)/D
iii.
G3(s)=((s+5)*9/5)/D
iv.
G4(s)=((s+10)*9/10)/D
Lab Task 2:
Consider the following systems with D=s^2+2s+4, from the step response determine
which are minimum phase and which are non-minimum phase systems. Compare the
response of G1 and G2 (find Ts, Tr and Tp) for both, which system is fast and why?
Lab Manual: Control System
Page 55
Also compare systems G2 and G3, find pole and zero for both systems and determine
why both systems have different responses?
i.
G1(s)=(s+4)/D
ii.
G2(s)=(-s+4)/D
iii.
G3(s)=(s-4)/D
Lab Task 3:
Consider the following systems and check whether pole zero cancellation possible or not, justify your
answer by some solid arguments.
i.
G1(s)=-(s-5)/{(s-4.99)(s+6)}
ii.
G2(s)=(s+5)/{(s+4.99)(s+6)}
Conclusion:
Lab Manual: Control System
Page 56
Lab No. 08
Design Control system using MATLAB
SISO design tool
Objective
 Brief introduction to SISO Design Tool, and Root Locus design using this GUI tool.
Theory Overview
MATLAB’s SISO Design Tool
The SISO ( Single- Input/ Single- Output) Design Tool is a graphical user interface which allows one to
design single-input/single-output compensators by interacting with the root locus plots and Bode plots of
the closed-loop/open-loop systems. The tool also has the option of using a Nichols chart, which can be
selected under the View menu. After the tool produces these plots, one can adjust the closed-loop poles
along the root locus and read gain, damping ratio, natural frequency, and pole locations. These changes
immediately get reflected to Bode plots and immediate changes in the system's closed-loop response can
be viewed in the LTI Viewer for SISO Design Tool window.
One can add poles, zeros, and compensators, which can be interactively changed to see the immediate
effects on the root locus, Bode plots, and time response.
With Bode plots, one can affect the gain change by shifting the Bode magnitude curve up and down; and
gain, gain margin, gain crossover frequency, phase margin, phase crossover frequency, and whether the
loop is stable or unstable can be checked. These changes immediately get reflected to root locus plots and
immediate changes in the system's closed-loop response can be viewed in the LTI Viewer for
SISODesign Tool window.
Equipment/Apparatus



MATLAB Software
Pentium-IV PC
AC Power Supply
Procedure
The following steps are required to use the SISO Design Tool.
1. Access the SISO Design Tool: The SISO Design Tool window, shown in Fig. 1, can be accessed
bytyping sisotool in the MATLAB Command Window or by executing this command in an M-file. In the
block diagram given in the top-right corner of SISO Design Tool window, C represents the compensator.
An interactive tutorial on SISO Design Tool can be invoked by selecting SISO Design Tool Help under
the SISO Design Tool window Help menu.
Lab Manual: Control System
Page 57
2. Create LTI transfer functions: Create open-loop LTI transfer functions for which you want
toanalyze closed-loop characteristics or design compensators. The transfer functions can be created in an
M-file or in the MATLAB Command Window. Run the M-file or MATLAB Command Window
statements to place the transfer function in the MATLAB workspace. All LTI objects in the MATLAB
workspace can be exported to the SISO Design Tool .
The following MATLAB commands create the transfer function.
3. Create the closed-loop model for the SISO Design Tool: ChooseImport…under the File menu inthe
SISO Design Tool window to display the window shown in Fig. 2
LTI objects can be selected from the SISO Models list and can be exported to one of the blocks of
the system by pressing the right-facing arrow next to the selected block ( G, H, F, or C ) located in the
section of the window labeled System Data. Press the Other… button to rotate through a selection of
feedback structures and select the desired configuration. Alternatively, this can also be done by pressing
the FS button on the bottom right corner of closed-loop block diagram in the SISO Design Tool window
(Fig.1). Root locus and Bode diagrams will change immediately to reflect the changes in the feedback
structure (Fig. 3).
LTI transfer function generating command, tf(num,den), can also be supplied directly into the
spaces for transfer functions in Fig. 3.
(Fig 1)
Lab Manual: Control System
Page 58
4. Interact with the SISO Design Tool: After the Import System Data window closes, the SISO
Design Tool window now contains the root locus and Bode plots for the system as shown in Fig. 3. Inthis
example, we have considered the open-loop system given by
Under the Analysis menu, select the desired response to open the LTI Viewer for SISO Design Tool
window (Fig. 4). Right-click on the LTI Viewer for SISO Design Tool and choose desired Plot Types,
Systems, and Characteristics.
(Fig 2 Import System Data Window)
Loop gain can be changed in three different ways:
i.
In Root Locus Editor: Keep the mouse pointer on a closed-loop pole (squares) on the root
locus.The arrow cursor changes to a hand. Hold down the left mouse button and drag the closedloop pole along the root locus. Bode plot and the closed-loop response in the LTI Viewer will
immediately change to reflect the gain change. The value of the gain will be displayed in the
Current Compensator section of the SISO Design Tool window.
ii.
In Open-Loop Bode Editor: Keep the mouse pointer anywhere on the Bode magnitude
curve.The arrow cursor changes to a hand. Hold down the left mouse button and shift the curve
up or down. Root locus and closed-loop response in the LTI Viewer will immediately change to
reflect the gain change.
Lab Manual: Control System
Page 59
iii.
In the Current Compensator Window: Type the desired gain value in the C(s)= box in the
SISO Design Tool window.
With gain changes, you can read the gain and phase margins and gain crossover and phase crossover
frequencies at the bottom of the Bode magnitude and phase plots. Also, at the bottom of the Bode
magnitude plot, you are told whether or not the closed-loop system is stable.
(Fig 3 Root Locus & Bode Plots of G in SISO Design Tool Window)
(Fig 4 LTI Viewer for SISO Design Tool Window)
Lab Manual: Control System
Page 60
5. Design constraints: Design constraints may be added to your plots. These constraints may be
selectedby right-clicking a respective plot and selecting Design Constraints. To put new constraints,
choose New… and to edit existing constraints, choose Edit… . For example, Fig.5 shows the selection of
design
constraint: damping ratio=0.5. On pressing OK, indicators appear identifying portions of the root locus
where the damping ratio is less than 0.5(shaded gray), equal to 0.5(damping line), and greater than
0.5(Fig. 6). Note the change made in axes limits in this figure with respect to Fig. 3 using the
PropertyEditor (the description of the Property Editor is given in the next step).
Constraints may also be edited on the plots. Two black squares appear on the constraint. You can
drag these with your mouse anywhere in the plot region. Point the mouse at the boundary of the
constraint. When it changes to four-pointed arrow, you can drag the boundary to a new position. The
values of the constraints are displayed in the Status Bar at the bottom of the plots.
(Fig 5 Adding Design Constraints)
Lab Manual: Control System
Page 61
(Fig. 6 Adding Design Constraints)
6. Properties: Right-clicking in a plot's window and selectingProperties…displays the Property Editor
window. From this window, some of the properties of the plot such as axes labels and limits canbe
controlled. Try exploring various options available with root locus and Bode plot properties editor.
7. Add poles, zeros, and compensators: Poles and zeros may be added from the SISO Design Tool
window toolbar shown in Fig. 6. Let your mouse pointer rest on the button for a few seconds to see the
functionality of the button in the form of screen tips. Add real pole; Add real zero; Add complex pole;
Add complex zero; Delete pole/zero; ..... functions are available.
Use the SISO Design Tool toolbar and select the desired real/complex pole/zero compensator. Move the
mouse on the plots; your cursor shows that a compensator was selected.. Place the cursor arrow to the
point on the root locus or Bode plot where you want to add the compensator, and click. The compensator
will be updated in the Current Compensator section of the SISO Design Tool window. Compensator
addition will be reflected immediately in the root locus, Bode plots, and LTI Viewer for SISO
DesignTool window.
Go to SISO Tool Preferences… -->Options under the Edit menu to change the way the compensator is
represented.
8. Editing compensators and pre filters: The pole and zero values of the compensators and prefilterscan
be edited in several ways. The most convenient is to click on C or F blocks in the block diagram
representation in top-right corner of the SISO Design Tool window (Fig. 6).This operation will open
prefilter or compensator editor window shown in Fig. 7. Desired real/complex zero/pole locations can be
edited here. The same windows can also be opened by following Compensators →Edit→C or F from
the SISO Design Tool window.
In control systems design, we use compensators of the form
that alter the roots of the characteristic equation of the closed-loop system. However, the closed-loop
transfer function, M(s), will contain the zero of D(s) as a zero of M(s).This zero may significantly affect
the response of the system M(s). We may use a prefilter F(s) to reduce the effect of this zero on M(s). For
example, if we select
we cancel the effect of the zero without changing the dc gain.
Prefilters may be employed with lead/PD compensation.
Lab Manual: Control System
Page 62
(Fig 7 Editing Compensators & Prefilters)
Design Problem: Consider a plant with the following transfer function:
We will design a cascade controller using SISO Design Tool in interactive mode, so that the unity
feedback closed-loop system meets the following criteria
Steady-state error due to unit-ramp input
Maximum overshoot
Rise time
Settling time
Lab Manual: Control System
Page 63
The first step is to import the model into SISO Design Tool. System transfer functions can be imported in
SISO Design Tool by clicking on File and then going to Import… Before executing this sequence, create
transfer function G in MATLAB Command Window:
In order to examine the system performance, we start by using a proportional controller. The system root
locus can be obtained by clicking on View in the main menu and then selecting Root Locus only. Fig. 8
shows the root locus of the system. The plot is for K =1(by default).
(Fig 08.)
In order to see the poles and zeros of G and H , go to the View menu and select System Data, or
alternatively, double click the block G or H in the top-right corner of the block diagram in the
SISODesign Tool window. The System Data window is shown in Fig. 9.
Lab Manual: Control System
Page 64
You may obtain the closed-loop system poles by selecting Closed-Loop Poles from the View menu.
Closed-loop poles are given in Fig.10.
(Fig 10)
In order to see the closed-loop system time response to a unit-step input, select the Response to
StepCommand in the Analysis main menu. With specific selections made in Systems and
Characteristics submenus, we generate Fig. 11 below, which shows the unit step response of the closedloop system with unity gain controller, i.e. , K= 1.
Lab Manual: Control System
Page 65
As a first step to design a controller, we use the built-in design criteria option within the SISO
DesignTool to establish the desired closed-loop poles regions on the root locus. To add the design
constraints,use the Edit menu and choose the Root Locus option. Select New to enter the design
constraints. The Design Constraints option allows the user to investigate the effect of the following:


Settling time



Percent overshoot
Damping ratio
Natural frequency
We will use the settling time and the percent overshoot as primary constraints. After designing a
controller based on these constraints, we will determine whether the system complies with the rise time
constraint or not. Fig 12 shows the addition of settling time constraint. Peak overshoot constraint is added
on similar lines.
Lab Manual: Control System
Page 66
(Fig 12)
Fig13 shows the desired closed-loop system pole locations on the root locus after inclusion of the design
constraints (Note that the scale has been modified by following Right click --> Properties --> Limits.
Left-clicking anywhere inside plot will remove the black squares on the zeta lines). Obviously, closedloop poles of the system for K = 1 are not in the desired area. Note the definition of the desired area: the
vertical gray bar signifies the boundary for that portion of the root locus where the settling time
requirement is not met; and the gray bars on damping lines signify the boundary for that portion of the
root locus where the peak overshoot requirement is not met.
Changing K will affect the pole locations. In the Root Locus window, C(s) represents the controller
transfer function. Fig.13 corresponds to C(s) = K = 1. Hence, if C(s) is increased, the effective value of K
increases, forcing the closed-loop poles to move together on the real axis, and then ultimately to move
apart to become complex. See Fig. 14 wherein K= 16.8 gives closed-loop poles on the damping lines.
However, the settling time requirement is not met.
(Fig 13)
Lab Manual: Control System
Page 67
(Fig 14)
The closed-loop poles of the system must lie to the left of the boundary imposed by the settling
time(Fig.14). Obviously, it is impossible to use the proportional controller (for any value of K ) to move
the poles of the closed-loop system farther to the left-hand plane. However, a PD controller
C(s)= K (1+ sTD) may be used to accomplish this task. The zero s = - 1/ TDof the compensator has to
beplaced far into the left half plane to move the root-locus plot to the left. We have tried various values:
s = - 1/0.0005; - 1/0.001; - 1/0.0015; - 1/0.002,...
The value s = -1/0.00095 gives satisfactory results.
To add a zero to the controller, click the C block in the block diagram in top-right corner of Fig. 14. Fig.
15 shows the Edit Compensator window and how the PD controller is added:
(Fig 15)
Fig 16 shows the plot for s= - 1/0.00095. Note that the closed-loop poles have been dragged to the desired
locations. The value of K that achieves the desired dominant closed-loop poles is 282. This value of K
forces the closed-loop poles to the desired region. The system closed-loop poles are shown in Fig.17.
Lab Manual: Control System
Page 68
(Fig 16)
(Fig 17)
The step response of the controlled system in Fig.18 shows that the system has now complied with all
design criteria.
Discussion on Results:
Conclusion:
Lab Manual: Control System
Page 69
Lab No. 09
To illustrate the Analysis of different control system
configurations on PID Controller Trainer IT-4406.
OBJECTIVE
Analysis of Open Loop system, Closed Loop system, Closed Loop system with disturbance and
steady state error on PID Control trainer IT-4406.
Theory Overview:
Equipment/Apparatus Required:
PID Control Trainer IT-4406
Open Loop System
Procedure
Lab Manual: Control System
Page 70
Closed Loop System
Procedure
Lab Manual: Control System
Page 71
Closed Loop System with disturbance
Procedure
Lab Manual: Control System
Page 72
Closed Loop System with Steady State Error
Procedure
Results:
Discussion on Results:
Conclusion:
Lab Task:
Lab Manual: Control System
Page 73
Lab No. 10
To illustrate the Analysis of different types of
controller on PID Controller Trainer IT-4406.
OBJECTIVE:
Analysis of ON/OFF controller, Proportional Controller, Integrator Controller and Derivative
Controller.
Theory Overview:
A proportional–integral–derivative controller (PID controller or three-term controller) is
a control loop feedback mechanism widely used in industrial control systems and a variety of
other applications requiring continuously modulated control. A PID controller continuously
calculates an error value as the difference between a desired setpoint (SP) and a
measured process variable (PV) and applies a correction based on proportional, integral,
and derivative terms (denoted P, I, and D respectively), hence the name.
In practical terms it automatically applies accurate and responsive correction to a control
function. An everyday example is the cruise control on a car, where external influences such as
hills (gradients) would decrease speed. The PID algorithm restores from current speed to the
desired speed in an optimal way, without delay or overshoot, by controlling the power output of
the vehicle's engine.
Equipment/Apparatus Required:
PID Control Trainer IT-4406
ON/OFF Controller
Procedure
Lab Manual: Control System
Page 74
Proportional Controller
Procedure
Lab Manual: Control System
Page 75
Integrator Controller
Procedure
Lab Manual: Control System
Page 76
Derivative Controller
Procedure
Lab Manual: Control System
Page 77
Results:
Discussion on Results:
Conclusion:
Lab Task:
Lab Manual: Control System
Page 78
Lab No. 11
To illustrate the Analysis of Proportional + Integrator + Derivative
(PID) controller on PID Controller TrainerIT-4406.
OBJECTIVE:
Analysis of PI Controller, PD Controller, PID Controller and PID Controller in a
Closed Loop system.
Theory Overview:
A proportional–integral–derivative controller (PID controller or three-term controller) is
a control loop feedback mechanism widely used in industrial control systems and a variety of
other applications requiring continuously modulated control. A PID controller continuously
calculates an error value as the difference between a desired setpoint (SP) and a
measured process variable (PV) and applies a correction based on proportional, integral,
and derivative terms (denoted P, I, and D respectively), hence the name.
In practical terms it automatically applies accurate and responsive correction to a control
function. An everyday example is the cruise control on a car, where external influences such as
hills (gradients) would decrease speed. The PID algorithm restores from current speed to the
desired speed in an optimal way, without delay or overshoot, by controlling the power output of
the vehicle's engine.
Equipment/Apparatus Required:
PID Control Trainer IT-4406
Proportional + Integrator Controller
Procedure
Lab Manual: Control System
Page 79
Lab Manual: Control System
Page 80
Proportional + Derivative Controller
Procedure
Lab Manual: Control System
Page 81
Proportional + Integrator + Derivative Controller
Procedure
Proportional + Integrator + Derivative Controller in a Closed Loop
Procedure
Lab Manual: Control System
Page 82
Results:
Discussion on Results:
Conclusion:
Lab Task:
.
Lab Manual: Control System
Page 83
Lab No. 12
Toillustrate the Analysis of Proportional + Integrator +
Derivative (PID) controller with first-order and Secondorder systems on PID Controller Trainer IT-4406.
Objective:
Analysis of PID Controller with first-order and second-order systems
Apparatus:
PID Control Trainer IT-4406
Theory:
The Characteristics of P, I, and D Controllers:
•
•
•
A proportional controller (kp) will have the effect of reducing the rise time and will reduce but
never eliminate the steady-state error.
An integral control (ki) will have the effect of eliminating the steady-state error for a constant or
step input, but it may make the transient response slower.
A derivative control (kd) will have the effect of increasing the stability of the system, reducing
the overshoot, and improving the transient response.
Note that these corrections may not be accurate, because KP, KI, and KD are dependent of each other. In
fact, changing one of these variables can change the effect of the other two. For this reason the table
should only be used as a reference when you are determining the values for KP, KI, and KD.
Lab Manual: Control System
Page 84
PID Controller with First order system
Procedure
PID controller with Second order system
Procedure
Lab Manual: Control System
Page 85
Lab Task:
Consider a process given below to be controlled by a PID controller,
a) Obtain the unit step response of Gp(s).
b) Try PI controllers with (Kp=2, 10, 100), and Ki=Kp/10. Investigate the unit step response in each case,
compare the results and comment.
c) Let Kp=100, Ki=10, and add a derivative term with (Kd=0.1, 0.9, 2). Investigate the unit step response
in each case, compare the results and comment.
Conclusion:
Lab Manual: Control System
Page 86
Lab No. 13
To demonstrate the Controllability &
Observability properties of control system in
state space
Objective:
i)
To implement the advanced control techniques in state space.
Apparatus:
ii)
Software: Matlab 7.12.0.635 (R2011a)
Theory:
Advanced Control Techniques:
• Pole Placement (states feedback control and observer)
• LQR
• LQG
• Robust Control
In advanced control techniques we only discuss about pole placement method.
Pole-Placement Design (states feedback control and observer):
The control is achieved by feeding back the state variables through a regular with constant gains.
Consider the control system presented in the stare-variable from
Now consider the system with the following state feedback control:
where K is a 1 x n vector of constant feedback gains. The control system input r(t) is assumed to be zero.
The purpose of this system is to return all state variables to values of zero when the states have been
perturbed.
Choice of closed loop poles:
1. Stable poles in LHP at suitable position must not be disturbed.
2. Unstable must be reflected in LHP
3. Pair of complex and conjugate gate can be placed to improve time domain specs e.g. -2±2 for
damping ratio to be 0.707.
4. Do not choose the closed loop poles far away from the open loop poles, otherwise it will
demand high control effort or
5. Do not choose the closed loop poles very negative, otherwise the system will be fast reacting (i.e.
Lab Manual: Control System
Page 87
it will have a small time constant).
6. In frequency domain it leads to large bandwidth, and hence noise gets amplified.
7. Fast sensors are not available.
Controllability & Observability:


A linear system is said to be completely controllable if, for all initial times and all initial states,
there exists some input function (or sequence for discrete systems) that drives the state vector to
any final state at some finite time t0  t1.
A linear system is said to be completely observable if, for all initial times, the state vector can be
determined from the output function (or sequence), defined over a finite time
.t0  t1
x (t )  Ax(t )  Bu (t )
y (t )  Cx(t )  Du (t )
A necessary and sufficient condition of controllability of the system on the interval [0,T], for any T>0, is
Rank =[ B AB ……….An-1B]= n
Controllability matrix
U=[B AB A2B ……. An-1B]
Observability matrix
V=[ C
CA
CA2
.
.
.
CAn-1]
PROCEDURE:
•
•
1. This example shows how to place pole for the system given by
G= 4/s3+5s2+4s
As a first pass, create a model of the system
Results:
Discussion on results:
Conclusion:
Lab Manual: Control System
Page 88
Lab No.14
To illustrate the Frequency Response Characteristics of Control
Systems
Objective:
Analysis on Bode/Nyquist Plots and Frequency response characteristics of Unity
Feedback systems and Non-unity feedback systems
Apparatus:
A Computer System with MATLAB
Theory Overview:
Bode Plots
For a given transfer function G(s), Bode plot can be produced in different ways:
1. By simply using the command
bode (G)
We will get the Bode plot of G(s) in the current window for a default frequency range set by the
MATLAB package. MATLAB will automatically choose the frequency values by placing more points in
regions where the frequency response is changing rapidly.
Procedure:
Bode plot for above G(s) is generated by the following code.
Lab Manual: Control System
Page 89
2. To produce a Bode plot over a specified frequency range wmin to wmax, we use the command
bode (G, {wmin, wmax})
For example, bode(G,{0.1,10}) will produce a Bode plot in the range 0.1 to 10 rad/sec.
If we supply the vector
w = [0.1; 0.3; 0.5; 0.7; 0.9; 1.0; 3.0; 5.0; 7.0; 9.0; 10];
Lab Manual: Control System
Page 90
and type
bode (G,w)
MATLAB will compute the magnitude and phase at the frequency points supplied in the frequency
vector.
If you choose to specify the frequencies explicitly, it is desirable to generate the vector w using the
logspace function. logspace (d1,d2) generates a vector of 50 points logarithmically equally spaced
between decades 10d1 and 10d2. (50 points include both endpoints. There are 48 points between the
endpoints). To generate 50 points between 0.1 rad/sec and 100 rad/sec, enter the command
w = logspace (-1,2)
logspace(d1,d2,n) generates n points logarithmically equally spaced between decades 10d1 and 10d2 ( n
points include both endpoints). For example, to generate 100 points between 1 rad/sec and 1000
rad/sec, enter the command
w = logspace (0,3,100)
3. When invoked with left-hand arguments, such as
[mag,phase,w] = bode (G)
bode returns the frequency response of the system in variables mag, phase and w. No plot is drawn on
the screen. The magnitude and phase characteristics are placed in the workspace through the matrices
mag and phase. The vector w contains the values of the frequency in rad/sec at which the magnitude
and phase will be calculated.
If we supply the vector w and type
[mag, phase, w] = bode (G,w)
MATLAB will use the frequency vector supplied and compute the magnitude and phase at those
frequency points. This is clear from the following MATLAB session.
Lab Manual: Control System
Page 91
MATLAB does not assume that the system is a SISO system, but allows greater flexibility for dealing
with more complex systems. MATLAB stores mag and phase variables as matrices of dimension p
x q x n, where p is the number of inputs, q is the number of outputs, and n is the number of
frequency points. For SISO systems, the dimension of mag and phase will be 1 x 1 x n. To access
the magnitude and phase points for pth input and qth output, we have to write mag(p, q, :) or
phase(p, q, :). For example, For SISO systems, mag(:,:,3) and phase(:,:,3) will also give the same
answer.
We use mag(:,:)', phase(:,:)' to convert arrays to column vectors, where the apostrophe signifies
matrix transpose. For example, the following command stores points of the Bode plot in matrix
form with magnitude in dB, phase in degrees, and frequency in rad/sec.
Information about the plots obtained with bode can be found by left-clicking the mouse on the
curve. You can find the curve's label, as well as the coordinates of the point on which you clicked.
Right-clicking away from a curve brings up a menu.
Form this menu, you can select
(i) system responses to be displayed (magnitude plot, phase plot, or both)
(ii) characteristics, such as peak response and stability margins.
When selected, a dot appears on the curve at the appropriate point. Let your mouse rest on the
point to read the value of the characteristic. You may also
(iii) select the frequency units in Hz., magnitude in absolute, phase in radians,
(iv) set axis limits
(v) grid
Nyquist Plots
We can use MATLAB to make Nyquist plots using the command nyquist(G). Information about
the plots obtained with this command can be found by left-clicking the mouse on the curve. You
can find the curve's label, as well as the coordinates of the point on which you have clicked and the
frequency. Right-clicking away from a curve brings up a menu. From this menu, you can select (i)
system responses to be displayed (with and without negative frequencies), and (ii) characteristics,
such as peak response and stability margins.
Lab Manual: Control System
Page 92
When selected, a dot appears on the curve at the appropriate point. Let your mouse rest on the
point to read the value of the characteristic. You may also (iii) select the frequency units in Hz., (iv)
set axis limits, and (v) grid etc.
We can obtain points on the plot by using [re im w] = nyquist(G), where the real part, imaginary
part, and frequency are stored in re, im, and w, respectively. re and im are 3-dimensional arrays. We
use re(:,:)' and im(:,:)' to convert the arrays to column vectors. We can specify the range of w by
using [re,im] = nyquist(G,w).
A sample Nyquist plot generation is illustrated below.
Note that when a MATLAB operation involves ' Divide by zero ', the resulting Nyquist plot may
be erroneous. For example, Nyquist plot of system G(s) = 1/ s* (s+1) can be generated as below:
G= 1/ (s *(s+1));
Nyquist(G)
Stability Margins
We use [GM, PM] = margin(G) to find gain margin (GM) and phase margin (PM).
We use [GM, PM, wg, wphi] = margin(G) to find gain margin (GM), phase margin (PM), gain
crossover frequency (wg), and phase crossover frequency (wphi).
The margin function is invoked in conjunction with the bode function to compute gain and phase
margins. If the margin(G) is invoked without left-hand arguments, the Bode plot is automatically
generated with gain margin, phase margin, gain crossover frequency, and phase crossover frequency
labeled on the plot.
S=tf(‘s’);
G=1/(s^2+0.8*s+1);
Margin(G)
Non-unity Feedback Systems
Consider a non-unity feedback system with forward-path transfer function
Lab Manual: Control System
Page 93
G(s)= 10/(s*(s+5)) and feedback transfer function is H(s) =1/0.1*s+1
Resonance peak, resonance frequency, and bandwidth of the closed-loop frequency response may be
obtained by generating Bode plot of the closed-loop transfer function.
Unity Feedback Systems on Nichols Chart
Nichols chart can be generated using the nichols(G) function for the MATLAB transfer function
G. If the nichols function is invoked without left-hand arguments, the Nichols chart is automatically
generated; otherwise one must use nichols in conjunction with the plot function. A Nichols grid
can be drawn with the ngrid function. Information about the plots obtained with nichols(G) can be
found by left-clicking the mouse on the curve. You can find the curve's label, as well as the
coordinates of the point on which you clicked, and the frequency. Right-clicking away from a curve
brings up a menu. From this menu, you can select characteristics, such as peak response and stability
margins. When selected, a dot appears on the curve at the appropriate point Let your mouse rest on
the point to read the value of the characteristic. You may also select choice for grid on or off,
returning to full view after zooming, and properties, such as labels, limits, units, style, and
characteristics.
Consider a unity feedback system with open-loop transfer function
G= 1/ (s *(s+1));
Write a MATLAB code to create a nichols chart for this system.
The corner frequency of the lag term is at w = 5 rad/sec. We will like to include a range of
frequencies a decade above and below this corner frequency. Setting the frequency range from 0.5 to
50 rad/sec meets our requirements.
Gain and phase margins can also be determined from Nichols chart. However, the margin function
is a convenient alternative. In the given example we study how to adjust the system gain to meet
specifications on gain margin, phase margin, bandwidth and resonance peak. We consider a unity
feedback system with open-loop transfer function.
Results:
Discussion on results:
Conclusion:
Lab Task:
1- Generate the nyquist plot, bode plot and nichols chart for three systems.
Lab Manual: Control System
Page 94
Lab Manual: Control System
Page 95
Download