Control Theory - 3141708 Lab Manual - 4th Sem
Control Theory - 3141708 Lab Manual - 4th Sem
Control Theory
(3141708)
Directorate of Technical
Education ,Gandhinagar,Gujarat
Government Engineering College, Gandhinagar
Certificate
This is to certify thatMr./Ms. ___________________________________
________ Enrollment No. _______________of B.E. Semester
_____Instrumentation and Control Engineering of this Institute (GTU Code:
_____ )hassatisfactorily completed the Practical / Tutorial work for the
subject Control Theory (3141708) for the academic year 2022-23.
Place: __________
Date: __________
HeadoftheDepartment
Control Theory (3141708)
Preface
Main motto of any laboratory/practical/field work is for enhancing required skills as well as
creating ability amongst students to solve real time problem by developing relevant
competencies in psychomotor domain.By keeping in view, GTU has designed competency
focused outcome-based curriculum for engineering degree programs where sufficient weightage
is given to practical work. It shows importance of enhancement of skills amongst the students
and it pays attention to utilize every second of time allotted for practical amongst students,
instructors and faculty members to achieve relevant outcomes by performing the experiments
rather than having merely study type experiments. It is must for effective implementation of
competency focused outcome-based curriculum that every practical is keenly designed to serve
as a tool to develop and enhance relevant competency required by the various industry among
every student. These psychomotor skills are very difficult to develop through traditional chalk
and board content delivery method in the classroom. Accordingly, this lab manual is designed
to focus on the industry defined relevant outcomes, rather than old practice of conducting
practical to prove concept and theory.
By using this lab manual students can go through the relevant theory and procedure in advance
before the actual performance which creates an interest and students can have basic idea prior to
performance. This in turn enhances pre-determined outcomes amongst students. Each
experiment in this manual begins with competency, industry relevant skills, course outcomes as
well as practical outcomes (objectives). The students will also achieve safety and necessary
precautions to be taken while performing practical.
This manual also provides guidelines to faculty members to facilitate student centric lab
activities through each experiment by arranging and managing necessary resources in order that
the students follow the procedures with required safety and necessary precautions to achieve the
outcomes. It also gives an idea that how students will be assessed by providing rubrics.
Engineering Thermodynamics is the fundamental course which deals with various forms of
energy and their conversion from one to the another. It provides a platform for students to
demonstrate first and second laws of thermodynamics, entropy principle and concept of energy.
Students also learn various gas and vapor power cycles and refrigeration cycle. Fundamentals of
combustion are also learnt.
Utmost care has been taken while preparing this lab manual however always there is chances of
improvement. Therefore, we welcome constructive suggestions for improvement and removal
of errors if any.
Control Theory (3141708)
Simulate and analyse steady state error for type ‘0’, ‘1’ √
6. and ‘2’ system for step and impulse input. √
The following industry relevant competency are expected to be developed in the student by
undertaking the practical work of this laboratory.
1. Apply fundamentals of system dynamics
2. Apply suitable control strategy
Guidelines for Faculty members
1. Teacher should provide the guideline with demonstration of practical to the students
with all features.
2. Teacher shall explain basic concepts/theory related to the experiment to the students
before starting of each practical
3. Involve all the students in performance of each experiment.
4. Teacher is expected to share the skills and competencies to be developed in the
students and ensure that the respective skills and competencies are developed in the
students after the completion of the experimentation.
5. Teachers should give opportunity to students for hands-on experience after the
demonstration.
6. Teacher may provide additional knowledge and skills to the students even though not
covered in the manual but are expected from the students by concerned industry.
7. Give practical assignment and assess the performance of students based on task
assigned to check whether it is as per the instructions or not.
8. Teacher is expected to refer complete curriculum of the course and follow the
guidelines for implementation.
Index
(Progressive Assessment Sheet)
Sr. Objective(s) of Experiment Page Date of Date of Assessme Sign. of Remar
No. No. perform submiss nt Teacher ks
ance ion Marks with date
Introduction to MATLAB for control
1.
systems.
Simulation and study of systems and models
2.
using control design software.
Find unit step response of first order system
3.
using scilab.
Building and analyzing multi block models
4.
using control design software.
Find Unit step response of first and second
5. order system using MATLAB.
Experiment No: 1
Introduction to MATLAB for control systems.
Date:
Theory
Matlab (Matrix laboratory) is an interactive software system for numerical computations and
graphics. As the name suggests, Matlab is especially designed for matrix computations: solving
Control Theory (3141708)
systems of linear equations, computing eigenvalues and eigenvectors, factoring matrices, and so
forth. In addition, it has a variety of graphical capabilities, and can be extended through programs
written in its own programming language. Many such programs come with the system; a number
of these extend Matlab's capabilities to nonlinear problems, such as the solution of initial value
problems for ordinary differential equations.
Matlab is designed to solve problems numerically, that is, in finite-precision arithmetic. Therefore
it produces approximate rather than exact solutions, and should not be confused with a symbolic
computation system (SCS) such as Mathematica or Maple. It should be understood that this does
not make Matlab better or worse than an SCS; it is a tool designed for different tasks and is
therefore not directly comparable.
In the following sections, I give an introduction to some of the most useful features of Matlab. I
include plenty of examples; the best way to learn to use Matlab is to read this while running
Matlab, trying the examples and experimenting.
The basic data type in Matlab is an n-dimensional array of double precision numbers. Matlab 5
differs from earlier versions of Matlab in that other data types are supported (also in the fact that
general, multi-dimensional arrays are supported; in earlier versions, every variable was a two-
dimensional array (matrix), with one-dimensional arrays (vectors) and zero-dimensional arrays
(scalars) as special cases). The new data types include structures (much like structures in the C
programming language--data values are stored in named fields), classes, and ``cell arrays'', which
are arrays of possibly different data types (for example, a one-dimensional array whose first entry
is a scalar, second entry a string, third entry a vector). I mostly discuss the basic features using n-
dimensional arrays, but I briefly discuss the other data types later in the paper.
The following commands show how to enter numbers, vectors and matrices, and assign them to
variables (>> is the Matlab prompt on my computer; it may be different with different computers
or different versions of Matlab. I am using version 5.2.0.3084. On my Unix workstation, I start
Matlab by typing matlab at the Unix prompt.):
>> a = 2
a=
2
>> x = [1;2;3]
x=
1
2
3
>> A = [1 2 3;4 5 6;7 8 0]
A=
1 2 3
4 5 6
7 8 0
Notice that the rows of a matrix are separated by semicolons, while the entries on a row are
separated by spaces (or commas).
A useful command is ``whos'', which displays the names of all defined variables and their types:
>>whos
Name Size Bytes Class
A 3x3 72 double array
Control Theory (3141708)
One way to enter a n-dimensional array (n>2) is to concatenate two or more (n-1)-dimensional
arrays using the cat command. For example, the following command concatenates two 3 ×2
arrays to create a 3 ×2 ×2 array:
>> C = cat(3,[1,2;3,4;5,6],[7,8;9,10;11,12])
C(:,:,1) =
1 2
3 4
5 6
C(:,:,2) =
7 8
9 10
11 12
>>whos
Name Size Bytes Class
A 3x3 72 double array
C 3x2x2 96 double array
a 1x1 8 double array
x 3x1 24 double array
The result of the last calculation not assigned to a variable is automatically assigned to the
variable ans, which can then be used as any other variable in subsequent computations. Here is an
example:
>> 100^2-4*2*3
ans =
9976
>>sqrt(ans)
ans =
Control Theory (3141708)
99.8799
>> (-100+ans)/4
ans =
-0.0300
The arithmetic operators work as expected for scalars. A built-in variable that is often useful is :
>>pi
ans =
3.1416
Above I pointed out that the square root function is built-in; other common scientific functions,
such as sine, cosine, tangent, exponential, and logarithm are also pre-defined. For example:
>>cos(.5)^2+sin(.5)^2
ans =
1
>>exp(1)
ans =
2.7183
>>log(ans)
ans =
1
Other elementary functions, such as hyperbolic and inverse trigonometric functions, are also
defined.
At this point, rather than providing a comprehensive list of functions available in Matlab, I want
to explain how to get this information from Matlab itself. An extensive online help system can be
accessed by commands of the form help <command-name>. For example:
>> help pi
PI 3.1415926535897....
PI = 4*atan(1) = imag(log(-1)) = 3.1415926535897....
A good place to start is with the command help help, which explains how the help systems works,
as well as some related commands. Typing help by itself produces a list of topics for which help is
available; looking at this list we find the entry ``elfun--elementary math functions.'' Typing help
elfun produces a list of the math functions available. We see, for example, that the inverse tangent
function (or arctangent) is called atan:
>>pi-4*atan(1)
ans =
0
It is often useful, when entering a matrix, to suppress the display; this is done by ending the line
with a semicolon (see the first example in the next section). The command more can be used to
cause Matlab to display only one page of output at a time. Typing more on causes Matlab to pause
Control Theory (3141708)
between pages of output from subsequent commands; as with the Unix ``more'' command, a space
character then advances the output by a page, a carriage return advances the output one line, and
the character ``q'' ends the output. Once the command more on is issued, this feature is enabled
until the command more off is given.
Graphs
The simplest graphs to create are plots of points in the cartesian plane. For example:
>> x = [1;2;3;4;5];
>> y = [0;.25;3;1.5;2];
>>plot(x,y)
The resulting graph is displayed in Figure 1.
Notice that, by default, Matlab connects the points with straight line segments. An alternative is
the following (see Figure 2):
>>plot(x,y,'o')
Control Theory (3141708)
>> A+B
ans =
2 3 4
6 7 8
10 11 12
>> A+C
Control Theory (3141708)
>> C*D
??? Error using ==> *
No functional support for matrix inputs.
By the same token, the exponentiation operator ^ is only defined for square 2-dimensional arrays
(matrices).
Solving matrix equations using matrix division
If A is a square, nonsingular matrix, then the solution of the equation Ax=b is . Matlab
implements this operation with the backslash operator:
>> A = rand(3,3)
A=
0.2190 0.6793 0.5194
0.0470 0.9347 0.8310
0.6789 0.3835 0.0346
>> b = rand(3,1)
b=
0.0535
0.5297
0.6711
Control Theory (3141708)
>> x = A\b
x=
-159.3380
314.8625
-344.5078
>> A*x-b
ans =
1.0e-13 *
-0.2602
-0.1732
-0.0322
(Notice the use of the built-in function rand, which creates a matrix with entries from a uniform
distribution on the interval (0,1). See help rand for more details.) Thus A\b is
(mathematically) equivalent to multiplying b on the left by (however, Matlab
does not compute the inverse matrix; instead it solves the linear system directly). When used with
a nonsquare matrix, the backslash operator solves the appropriate system in the least-squares
sense; see help slash for details. Of course, as with the other arithmetic operators, the
matrices must be compatible in size. The division operator is not defined for n-dimensional arrays
with n>2.
Vectorized functions and operators; more on graphs
Matlab has many commands to create special matrices; the following command creates a row
vector whose components increase arithmetically:
>> t = 1:5
t=
1 2 3 4 5
The components can change by non-unit steps:
>> x = 0:.1:1
x=
Columns 1 through 7
0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000
Columns 8 through 11
0.7000 0.8000 0.9000 1.0000
A negative step is also allowed. The command linspace has similar results; it creates a vector
with linearly spaced entries. Specifically, linspace(a,b,n) creates a vector of
length n with entries
>>linspace(0,1,11)
ans =
Columns 1 through 7
0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000
Columns 8 through 11
0.7000 0.8000 0.9000 1.0000
There is a similar command logspace for creating vectors with logarithmically spaced entries:
>>logspace(0,1,11)
ans =
Columns 1 through 7
1.0000 1.2589 1.5849 1.9953 2.5119 3.1623 3.9811
Columns 8 through 11
5.0119 6.3096 7.9433 10.0000
See help logspace for details.
A vector with linearly spaced entries can be regarded as defining a one-dimensional grid, which is
Control Theory (3141708)
useful for graphing functions. To create a graph of y = f(x) (or, to be precise, to graph points of the
form (x,f(x)) and connect them with line segments), one can create a grid in the vector x and then
create a vector y with the corresponding function values.
It is easy to create the needed vectors to graph a built-in function, since Matlab functions
are vectorized. This means that if a built-in function such as sine is applied to a array, the effect is
to create a new array of the same size whose entries are the function values of the entries of the
original array. For example (see Figure 3):
>> x = (0:.1:2*pi);
>> y = sin(x);
>>plot(x,y)
An important operator in Matlab is the single quote, which represents the (conjugate) transpose:
>> A = [1 2;3 4]
A=
1 2
3 4
Control Theory (3141708)
>> A'
ans =
1 3
2 4
>> B = A + i*.5*A
B=
1.0000 + 0.5000i 2.0000 + 1.0000i
3.0000 + 1.5000i 4.0000 + 2.0000i
>> B'
ans =
1.0000 - 0.5000i 3.0000 - 1.5000i
2.0000 - 1.0000i 4.0000 - 2.0000i
In the rare event that the transpose, rather than the conjugate transpose, is needed, the ``.'''
operator is used:
>> B.'
ans =
1.0000 + 0.5000i 3.0000 + 1.5000i
2.0000 + 1.0000i 4.0000 + 2.0000i
(note that ' and .' are equivalent for matrices with real entries).
The following commands are frequently useful; more information can be obtained from the on-
line help system.
Creating matrices
The commands zeros and ones can be given any number of integer arguments; with k arguments,
they each create a k-dimensional array of the indicated size.
format
o format short 3.1416
o format short e 3.1416e+00
o format long 3.14159265358979
o format long e 3.141592653589793e+00
o format compact suppresses extra line feeds (all of the output in this paper is in
compact format).
xlabel('string'), ylabel('string') label the horizontal and vertical axes, respectively, in the
current plot;
title('string') add a title to the current plot;
axis([a b c d]) change the window on the current graph to
hold on freezes the current plot so that subsequent graphs will be displayed with the
current;
hold off releases the current plot; the next plot will erase the current before displaying;
subplot puts multiple plots in one graphics window.
Miscellaneous
max(x) returns the largest entry of x, if x is a vector; see help max for the result when x is
a k-dimensional array;
min(x) analogous to max;
abs(x) returns an array of the same size as x whose entries are the magnitudes of the
entries of x;
size(A) returns a 1 ×k vector with the number of rows, columns, etc. of the k-dimensional
array A;
length(x) returns the ``length'' of the array, i.e. max(size(A)).
save fname saves the current variables to the file named fname.mat;
load fname load the variables from the file named fname.mat;
quit exits Matlab
Simulation Exercise:
1. Create a row vector R with values (0, 1, 3, 5, 1, 12, 14, 15).
2. Create a column vector C with values (0, 1, 3, 5, 1, 12, 14, 15).
3. Create 3×3 matrix of random elements.
4. Create 3×3 unity matrix.
5. Perform following Basic matrix operations:
a) Addition
b) Subtraction
c) Transposing
d) Matrix multiplication
e) Element wise multiplication
f) Exponential
g) Element wise Exponential
6. Create a random vector R of 1,000 uniformly distributed numbers. (Hint: use the rand
command.)
7. Create a random vector R of 1,000 normally distributed numbers. (Hint: use the randn com-
mand.)
8. Show how to create Multiple Plots and Subplots with random vector created in question 6 and
7.
9. Create a function which returns the product of given input number.
10. Generate first and second order transfer function using MATLAB
RESULT:
Control Theory (3141708)
CONCLUSION:
Quiz:
1. What is open lop control system?
2. What is closed loop control system?
3. What is green engineering?
Rubrics 1 2 3 4 5 Total
Marks
Rubrics:
1. Understand objectives of experiment.
2. Effective use of soft computing tools.
3. Question answer during lab session.
4. Outcome analysis and conclusion writing ability.
5. Submission in time.
References: https://www.mathworks.com/
Experiment No: 2
Simulation and study of systems and models Using Control Design Software.
Date:
1. Objectives:
(a) Simulate electrical system models.
(b) Simulate mechanical system models.
(c) Study systems models
Equipment/Instruments: Computer system with MATLAB.
Theory:
The first step in the control design process is to develop appropriate mathematical models of the
system to be controlled. These models may be derived either from physical laws or experimental
data. In this section, introduced the state-space and transfer function representations of dynamic
systems. Then review some basic approaches to modeling mechanical and electrical systems and
show how to generate these models in MATLAB for further analysis.
Mechanical Systems:
Newton's laws of motion form the basis for analyzing mechanical systems. Newton’s second law,
Equation(1) given below, states that the sum of the forces acting on a body equals the product of
its mass and acceleration. Newton's third law, states that if two bodies are in contact, then they
experience the same magnitude contact force, just acting in opposite directions.
……..(1)
When applying this equation, it is best to construct a free-body diagram (FBD) of the system
showing all of the applied forces.
The free-body diagram for this system is shown below. The spring force is proportional to the
displacement of the mass, , and the viscous damping force is proportional to the velocity of the
mass, . Both forces oppose the motion of the mass and are, therefore, shown in the
negative -direction. Note also that corresponds to the position of the mass when the spring
is unstretched.
Control Theory (3141708)
Now proceed by summing the forces and applying Newton’s second law, Equation (1), in each
direction. In this case, there are no forces acting in the -direction; however, in the -direction we
have:
…….(2)
This equation, known as the governing equation, completely characterizes the dynamic state of
the system. Later, we will see how to use this to calculate the response of the system to any
external input, , as well as to analyze system properties such as stability and performance.
To determine the state-space representation of the mass-spring-damper system, we must reduce
the second-order governing equation to a set of two first-order differential equations. To this end,
choose the position and velocity as our state variables.
…….(3)
The position variable captures the potential energy stored in the spring, while the velocity variable
captures the kinetic energy stored by the mass. The damper only dissipates energy, it doesn't store
energy. Often when choosing state variables it is helpful to consider what variables capture the
energy stored in the system.
The state equation in this case is:
……(4)
If, for instance, we are interested in controlling the position of the mass, then the output equation
is:
………(5)
The Laplace transform for this system assuming zero initial conditions is
and, therefore, the transfer function from force input to displacement output is
Control Theory (3141708)
s = tf('s');
sys = 1/(m*s^2+b*s+k)
Simulation Exercise:
1. Find state variable model for below given system and simulate using control design
software.
2. Find transfer function model for system given in question-1 and simulate using control
design software.
3. Find state variable model for below given system and simulate using control design
software.
4. Find transfer function model for system given in question-3 and simulate using control
design software.
CONCLUSION:
Quiz:
1. Explain need of system modeling.
2. What is transfer function?
3. What is open loop control system?
Control Theory (3141708)
Rubrics 1 2 3 4 5 Total
Marks
Rubrics:
1. Understand objectives of experiment.
2. Group work while performing experiment.
3. Question answer during lab session.
4. Outcome analysis and conclusion writing ability.
5. Submission in time.
References: https://www.mathworks.com/
Experiment No: 3
Find unit step response of first order system using scilab.
Date:
Theory:
cover many areas of scienti_c computing. The following is a short list of its capabilities:
Linear algebra, sparse matrices
Polynomials and rational functions
Interpolation, approximation,
Linear, quadratic and non linear optimization
Ordinary Di_erential Equation solver and Di_erential Algebraic Equations solver
Classic and robust control
Linear Matrix Inequality optimization,
Di_erentiable and non-di_erentiable optimization,
Signal processing
Statistics
Scilab provides many graphics features, including a set of plotting functions, which allow to
create 2D and 3D plots as well as user interfaces. The Xcos environment provides an hybrid
dynamic systems modeler and simulator.
simulation (time response) of linear system
Syntax
[y, x] = csim(u, t, sl)
[y, x] = csim(u, t, sl, x0)
[y, x] = csim(u, t, sl, x0, tol)
Arguments
u: function, list or string (control)
t: real vector specifying times with, t(1) is the initial time (x0=x(t(1))).
Sl: A SISO or SIMO linear dynamical system, in state space, transfer function or zpk
representations, in continuous time.
y: a matrix such that y=[y(t(i)], i=1,..,n
x: an optional matrix such that x=[x(t(i)], i=1,..,n
tol: a 2 vector [atolrtol] defining absolute and relative tolerances for ode solver (see ode)
Description
Simulation of the controlled linear system sl. sl is assumed to be a continuous-time system
represented by a syslin list.
u is the control and x0 the initial state.
y is the output and x the state.
The control can be:
1. A function : [inputs]=u(t)
2.alist: list(ut,parameter1,....,parametern) such that: inputs=ut(t,parameter1,....,parametern) (ut is a
function)
3.The string "impuls" for impulse response calculation (here sl must have a single input
and x0=0). For systems with direct feedthrough, the infinite pulse at t=0 is ignored.
4. The string "step" for step response calculation (here sl must have a single input and x0=0)
5. a vector giving the values of u corresponding to each t value.
Example
s=poly(0,'s');
rand('seed',0);
w=ssrand(1,1,3);
w('A')=w('A')-2*eye();
t=0:0.05:5;
//impulse(w) = step (s * w)
plot2d([t',t'],[(csim('step',t,tf2ss(s)*w))',0*t'])
Control Theory (3141708)
s = %s
poly (0 , ’ s ’)
K = 1 , T = 1 // Gain and t ime constant
SimpleSys = syslin ( ’ c ’ , K/(1+T*s ) )
t=0 : 0 . 0 1 : 1 5 ;
y1 = cs im ( ’ s t e p ’ , t , SimpleSys ) ; // s t e p r e s p o n s e
p l o t (t , y1)
Exercise:
10
1. Find step response for the system with transfer function: G ( S )= using scilab.
S +4
K
2. Find step response for the system with transfer function: G ( S )= using scilab,
TS+1
Consider different values of K=0.2, 1, 2 and T=1, 2, 3.
Control Theory (3141708)
Conclusion:
Quiz:
1. What is first order system?
2. Explain importance of standard test signals.
Rubrics:
1. Understand objectives of experiment.
2. Group work while performing experiment.
3. Question answer during lab session.
4. Outcome analysis and conclusion writing ability.
5. Submission in time.
References: https://www.scilab.org/software/scilab
Experiment No: 4
Building and analyzing multi block models using control design software.
Date:
Objectives: (a) Analyzing multi block models using control design software
Equipment/Instruments: Computer system with MATLAB.
Theory:
Series:-Series connection of two LTI models:
Syntax:
Description:
sys = series (sys 1,sys 2)
sys = series (sys 1,sys 2,outputs 1,inputs 2)
Series connects two LTI models in series. This function accepts any type ofLTI model. The
two systems must be either both continuous or both discrete with identical sample time static
gains are neutral and can be specified as regular matrices.
sys = series (sys 1,sys 2) forms the basic series connection shown below.
u
Sys1 Sys2 y
syssys1sys2
Parallel connects two LTI models in parallel. This function accepts any type of LTI model. The
two systems must be either both continuous or both discrete with identical sample time static
gains are neutral and can be specified as regular matrices.
sys = parallel (sys 1,sys 2) forms the basic parallel connection shown below.
Control Theory (3141708)
Sys
Sys1
U y
Sys2
SysSys1Sys2
Feedback:-
Syntax:
Feedback connection of two LTI models:
sys = feedback (sys 1,sys 2)
sys = feedback (sys 1,sys 2, sign)
sys = feedback (sys 1,sys 2, feedin, feedout, sign)
Description: sys = feedback (sys 1,sys 2) returns an LTI model sys for the negative feedback
interconnection.
+
u Sys1 y
Sys2
The closed loop model system has u as input vector and y as output vector. The LTI model
models sys 1 and sys 2 must be both continuous or both discrete with identical sample times.
SERIESCONNECTIONOFMULTIBLOCKMODELS
Create the series connection, denoted by the transfer function T(s), of the two systemwhose
Transfer function G1(s) & G2(s).
In each case create T(s) of the combined system as a ratio of polynomial and determine its zeroes,
poles and gain.
>> G1=tf([2 3],[5 2 2])
Transfer function:
2s+3
5 s^2 + 2 s + 2
Zero/pole/
gain:
5 (s+2)
(s+0.5) (s-8)
>> T=series(G1,G2)
Zero/pole/gain:
2 (s+2) (s+1.5)
(s+0.5) (s-8) (s^2 + 0.4s + 0.4)
>> F=tf(T)
Transfer function:
2 s^2 + 7 s + 6
s^4 - 7.1 s^3 - 6.6 s^2 - 4.6 s - 1.6
PARALLELCONNECTIONOFMULTIBLOCK MODELS
From the parallel connection of the two transfer functions given below. Determine the
zero’s, poles and gain T(s).
H1(s)= 2S+6
S2S8
H2(S)= (s+4)
S+1S24S1
H1=(tf([2 6],[118]);
s=tf(‘s’);
H2=(s+4)/((s+1)(s^2+4*s+1))
H=parallel(H1,H2)
[z,p,k]=zpk(H)
FEEDBACKCONNECTION OFMULTIBLOCKMODELS
Use MATLAB to create the feedback system where T(s) of single block is given below.
Determine the zero’s, poles and gain. Given tf:
G(s)= H(s)=
2s+1
4S25S
8
4s+7
S+1S
8
G=tf([21],[458];
H=(4s+7)/((s+1)*(s+8))
Fed=feedback(G,H)
Exercise:
Find the transfer function for below system.
Conclusion:
Quiz:
1. Explain system simplification techniques.
2. Compare block diagram with signal flow graph.
3. Why simplification(reduction) needed?
Rubrics:
1. Understand objectives of experiment.
2. Group work while performing experiment.
3. Question answer during lab session.
4. Outcome analysis and conclusion writing ability.
5. Submission in time.
References: https://www.mathworks.com/
Objectives: (a) Time response analysis for first and second order system using MATLAB.
Equipment/Instruments: Computer system with MATLAB.
Theory:
The Laplace transform of a system unit step response is the product of the system’s transfer
function, G(s) and 1/s, the transform of the unit step function. The poles of the resulting transform
are the poles of G(s) and a pole at s = 0(due to the unit-step input).
The step response can be computed and plotted using the step command from the Control System
Toolbox.
STEP FUNCTION: Step response of LTI systems.
SYNTAX:
step(sys)
step(sys,t)
step(sys1,sys2,….,sysN)
step(sys1,sys2,….,sysN,t)
step(sys1,’PlotStyle1’,…..,sysN,’PlotStyleN’)
[y,t,x]=step(sys)
DESCRIPTION:
Step calculates the unit step response of a linear system. Zero initial state is assumed in the State-
Space case. When invoked with no output arguments, this function plots the step response on the
screen.
Step (sys) plots the step response of an arbitrary LTI model sys. This model can be continuous or
discrete, and SISO or MIMO. The step response of multi-input systems is the collection of step
response for each input channel. The duration automatically based on the system poles and zeros.
Step(sys,t) sets the simulation horizon explicitly. You can specify either a final time t=Tfinal (in
seconds), or a vector of evenly spaced time samples of the form.
t= 0:dt: Tfinal.
First Order system:
Transfer Functions:
G(s) = 1/ (s+1)
>>num=[1];
>>den=[1 1];
>>h=tf(num,den)
Transfer function:1/s+1
>>step(h)
Second Order System:
(2)Process transfer function is given by G(s)=ω^2/s(s+2ξω)(open loop), where ω=5
,ξ=0.6,
Find the unit step response of unity feedback control system.
1. G(s)=ω^2/s(s+2ξω)
>>num=[25];
>>den=[1 6 25];
>>g=tf(num,den)
Transfer function: 25
s^2 + 6s+ 25
>>step(g)
b) Forξ=0.2
>>num=[1];
>>den=[1 0.4 1];
>>g=tf(num,den)
>>step(g)
c) Forξ=0.2
>>num=[1];
>>den=[1 0.4 1];
>>g=tf(num,den)
d) Forξ=1
>>num=[1];
>>den=[1 1 1];
>>g=tf(num,den)
>>step(g)
Exercise:
5
1. Find the impulse and step response of given transfer function: G ( S )=
.
S +2
2. Find the damping ratio ,damped natural frequency, maximum peak overshoot, rise time,
settling time with system having unity feedback and open loop
K
transfer function G ( S )= .
S (S+10)
Conclusion:
Quiz:
1. What is damped natural frequency?
2. What is maximum peak overshoot?
3. Explain effects of different damping ration on system performance.
Rubric wise marks obtained:
Rubrics 1 2 3 4 5 Total
Marks
Rubrics:
1. Understand objectives of experiment.
2. Group work while performing experiment.
3. Question answer during lab session.
4. Outcome analysis and conclusion writing ability.
5. Submission in time.
References: https://www.mathworks.com/
Objectives: (a) Analyse steady state error for type ‘0’, ‘1’ and ‘2’ system for step and impulse
input.
Equipment/Instruments: Computer system with MATLAB.
Exercise:
1. Obtain step response of a Type ‘0’ system having forward path transfer function of
1
G ( s )= 2 . Comment on steady state error.
s +s +2
2. Obtain impulse response ofaType‘0’systemhavingforwardpathtransferfunctionof
1
G ( s )= 2 .Comment on steady state error.
s +s +2
Conclusion:
Quiz:
1. What is type of the system?
2. What steady state error?
3. Explain effects on steady state error if type of the system changed for step input.
Rubrics 1 2 3 4 5 Total
Marks
Rubrics:
1. Understand objectives of experiment.
2. Group work while performing experiment.
3. Question answer during lab session.
4. Outcome analysis and conclusion writing ability.
5. Submission in time.
References:
Theory:
Poles and Stability
If pi is a pole of G(s), then the natural, or zero-input, the response of G(s) will consist of the mode
functions epit if pi is distinct, and tq epit, q = 0, 1,. . ., r – 1, if p i has multiplicity r. Thus the natural
response will decay to zero if Re[p i] < 0 for i = 1, . . . , n-that is, if all the poles are in the open left-
half of the s-plane, i.e., the left half-plane excluding the imaginary axis. Such a system is said to
be asymptotically stable.
If all the poles are in the open left-half plane except for distinct poles on the imaginary axis
and at the origin, the natural response will consist of undamped sinusoids or a nonzero constant,
and the system is said to be marginally stable.
If some of the poles are in the right-half of the s-plane or on the imaginary axis with multiplicity
greater than one, then the natural response will be unbounded and the system is said to be unstable.
Simulation Exercise:
20
1. Find stability of the system with open-loop transfer function G(s)= 2 . Consider
s +3 s +8
unity feedback.
s+ 1
2. Find stability of the system with open-loop transfer function G(s)= 2 . Consider
s +10 s +20
unity feedback.
4
3. Comment on stability of the system with open-loop transfer function G(s)= 3 2 .
s + s +2 s−10
Consider unity feedback.
[ ] []
4. Consider the system with state space 3 ẋ=0Ax+ Bu∧ y=Ax + Du with
0 2 model
A= 1 0 0 , B= 0 , C=[ 1 0 0 ] , D=[ 0 ] .
Comment on stability. 0 4 1 2
Conclusion:
Quiz:
1. What is BIBO stability?
2. What is characteristic equation?
3. What is relative stability?
Rubrics 1 2 3 4 5 Total
Marks
Rubrics:
1. Understand objectives of experiment.
2. Group work while performing experiment.
3. Question answer during lab session.
4. Outcome analysis and conclusion writing ability.
5. Submission in time.
References: https://www.mathworks.com/
Date:
Theory:
rlocus : Evans roots locus.
Transfer Functions:
G(s)=(k)/s(s+4)(s^2+4s+20)
>>k=260;
>>num=[260];
>>den=[181620800];
>>g=tf(num,den)
Transfer function:
260
s^5+8s^4 +16 s^3 +20 s^2+80s
>>rlocus(g)
RootLocus
10
8
6
4
Imagin Axis
0
-2
-4
-6
-8
-10
-15 - - 0 5 10
10 5
RealAxis
Simulation Exercise:
1. DrawrootlocusPlotofthefollowingtransferfunctionusingMATLABandfindthevalueofgainK
formarginalstability.Alsoverifyresulttheoretically:
K
G ( s )= .
S ( S +1 )
2. DrawrootlocusPlotofthefollowingtransferfunctionusingMATLABandfindthevalueofgainK
formarginalstability.Alsoverifyresulttheoretically:
K
G ( s )= .
S ( S +2 ) (S+10)
Conclusion:
Quiz:
1. What is root locus?
2. What is marginal stability?
3. Explain break away and break in points?
Rubrics 1 2 3 4 5 Total
Marks
Rubrics:
1. Understand objectives of experiment.
2. Effective use of soft computing tools.
3. Question answer during lab session.
4. Outcome analysis and conclusion writing ability.
5. Submission in time.
References: https://www.mathworks.com/
Theory:
Bode plots were first introduced by H.W. Bode, when he was working at Bell labs in the United
States. Now before I describe what are this plots it is very essential here to discuss a few
advantages over other stability criteria. Some of the advantages of this plot are written below:
Advantages of Bode Plot
1. It is based on the asymptotic approximation, which provides a simple method to plot the
logarithmic magnitude curve.
2. The multiplication of various magnitude appears in the transfer function can be treated as
an addition, while division can be treated as subtraction as we are using a logarithmic
scale.
3. With the help of this plot only we can directly comment on the stability of the system
without doing any calculations.
4. Bode plots provides relative stability in terms of gain margin and phase margin.
5. It also covers from low frequency to high frequency range.
Now there are various terms related to this plot that we will use frequently in this article.
1. Gain Margin: Greater will the gain margin greater will be the stability of the system. It
refers to the amount of gain, which can be increased or decreased without making the
system unstable. It is usually expressed in dB.
2. Phase Margin: Greater will the phase margin greater will be the stability of the system. It
refers to the phase which can be increased or decreased without making the system
unstable. It is usually expressed in phase.
3. Gain Cross Over Frequency: It refers to the frequency at which magnitude curve cuts the
zero dB axis in the bode plot.
4. Phase Cross Over Frequency: It refers to the frequency at which phase curve cuts the
negative times the 180degreeaxis in this plot.
5. Corner Frequency: The frequency at which the two asymptotes cuts or meet each other is
known as break frequency or corner frequency.
6. Resonant Frequency: The value of frequency at which the modulus of G (jω) has a peak
value is known as resonant frequency.
7. Factors: Every loop transfer function (i.e. G(s) × H(s)) product of various factors like
constant term K, Integral factors (jω), first order factors ( 1 + jωT) (±n) where n is an
integer, second order or quadratic factors.
8. Slope: There is a slope corresponding to each factor and slope for each factor is
expressed in the dB per decade.
9. Angle: There is an angle corresponding to each factor and angle for each factor
is expressed in the degrees.
Bode Plot
These are also known as logarithmic plot (because we draw these plots on semi-log papers) and
are used for determining the relative stabilities of the given system. Now in order to determine
the stability of the system using bode plot we draw two curves, one is for magnitude called
magnitude curve another for phase called Bode phase plot.
Now there are some results that one should remember in order to plot the Bode curve. These
results are written below:
Constant term K: This factor has a slope of zero dB per decade. There is no corner
frequency corresponding to this constant term. The phase angle associated with this
constant term is also zero.
Integral factor 1/(jω)n: This factor has a slope of -20 × n (where n is any integer)dB per
decade. There is no corner frequency corresponding to this integral factor. The phase
angle associated with this integral factor is-90 ×n here n is also an integer.
First order factor 1/ (1+jωT): This factor has a slope of -20 dB per decade. The
cornerfrequencycorrespondingtothisfactoris1/Tradianpersecond.Thephaseangleassociated
with this first factor is-tan-1(ωT).
First order factor (1+jωT): This factor has a slope of 20 dB per decade. The
cornerfrequencycorrespondingtothisfactoris1/Tradianpersecond.Thephaseangleassociated
with this first factor is tan-1(ωT).
Second order or quadratic factor: [{1/(1+(2ζ/ω)} × (jω) + {(1/ω 2)} × (jω)2)]: This
factorhasaslopeof-40dBperdecade.Thecornerfrequencycorrespondingtothisfactorisωn
radian per second. The phase angle associated with this first factor is- tan -1{ (2ζω /ωn) /
(1-(ω / ωn)2)} .
Keeping all these points in mind we are able to draw the plot for any kind of system. Now let us
discuss the procedure of making a bode plot:
1. Substitute the s=jωin the open loop transfer function G(s) ×H(s).
2. Find the corresponding corner frequencies and tabulate them.
3. Now we are required one semi-log graph chooses a frequency range such that the plot
should start with the frequency which is lower than the lowest corner frequency. Mark
angular frequencies on the x-axis, mark slopes on the left hand side of the y-axis
bymarkingazeroslopeinthemiddleandontherighthandsidemarkphaseanglebytaking-180
degrees in the middle.
4. Calculate the gain factor and the type or order of the system.
5. Now calculate slope corresponding to each factor.
(c) Now sketch the line with the help of corresponding slope of the given factor. Change the
slope at every corner frequency by adding the slope of the next factor. You will get magnitude
plot.
(d) Calculate the gain margin.
Description: Bode computes the magnitude and phase of the frequency response of LTI models.
When invoked without left side arguments. Bode producesa bode plot on the screen with
magnitude is plotted in decibels and the phase in degrees. The decibels calculation for mas is
computed as system’s frequency response. It is used to analyze system properties such as gain
margin, phase margin, pc gain, bandwidth, disturbance rejection and stability.
Draw a Bode Diagram of the system. Determine the resonant peak, resonant frequency and
bandwidth.
R(s) 1 C(s)
s(0.5s 1)( s 1)
Program:
num=[0 0 0 1];
den=[0.5 1.5 1 0];
sysp=tf(num,den)
sys=feedback(sysp,1)
w=logspace(-1,2,100)
[mag,phase,w]=bode(sys,w)
[mp,k]=max(mag)
resonantpeak=20*log10(mp)
resonantfreq=w(k)
n=1
while 20*log(mag(n))>=-3; n=n+1;
end
bandwidth=w(n)
Output:
>>bandwidth
bandwidth = 1.2328
>>resonantfreq
resonantfreq = 0.8111
>>resonantpeak
resonantpeak = 5.2808
Simulation Exercise:
1. Draw bode Plot of the following transfer function using MATLAB and find the value of
K
gain K such that gain margin 20db. Also verify result theoretically:G ( s )= .
S ( S +2 ) (S+7)
2. Draw bode Plot of the following transfer function using MATLAB and comment on
K
G ( s )=
stability. Also verify result : ( S +3 ) (S+ 4) .
Conclusion:
Quiz:
1. What is gain margin?
2. What is phase margin?
3. What is phase crossover frequency margin?
4. What is gain crossover frequency margin?
Rubrics 1 2 3 4 5 Total
Marks
Rubrics:
1. Understand objectives of experiment.
2. Effective use of soft computing tools.
3. Question answer during lab session.
4. Outcome analysis and conclusion writing ability.
5. Submission in time.
References: https://www.mathworks.com/
Date:
Competency and Practical Skills:
1. Simulate Nyquist contour using MATLAB.
Theory:
The stability analysis of a feedback control system is based on identifying the location of the
roots of the characteristic equation on s-plane. The system is stable if the roots lie on left hand
side of s-plane. Relative stability of a system can be determined by using frequency response
methods like Nyquist plot and Bode plot. Nyquist criterion is used to identify the presence of
roots of a characteristic equation in a specified region of s-plane. To understand Nyquist plot we
need to know about some of the terminologies .Contour : Closed path in a complex plane is
called contour
The Nyquist contour is a closed contour in the s-plane which completely encloses the entire right
hand half of s-plane. In order to enclose the complete RHS of s-plane a large semicircle path is
drawn with diameter along jω axis and centre at origin. The radius of the semicircle is treated as
infinity.
Nyquist Encirclement
A point is said to be encircled by a contour if it is found inside the contour.
Nyquist Mapping
The process by which a point in s-plane transformed into a point in F(s) plane is called mapping
and F(s) is called mapping function.
N(s) = 0 is the open loop zero and D(s) is the open loop pole From stability point of view no
closed loop poles should lie in the RH side of s-plane . Characteristics equation 1 + G(s) H(s) = 0
denotes closed loop poles .
Nyquist stability criterion says that N = Z - P where N is the total no. of encirclement about the
origin, P is the total no. of poles and Z is the total no. of zeroes. Case 1:- N = 0 (no encirclement),
so Z = P = 0 & Z = P If N = 0, P must be zero therefore system is stable. Case 2:- N > 0
(clockwise encirclement), so P = 0 , Z ≠0 & Z > P For both cases system is unstable. Case 3 :- N <
0 (counterclockwise encirclement), so Z = 0, P ≠0 & P > Z System is stable
Consider a unity feedback system with the open loop transfer function
20( s2 +s +0 .5 )
G(s)H(s)= s (s +1)( s+10 )
num=[0 20 20 10];
den=[1 11 10 0];
nyquist(num,den)
grid
axis([-2 3 -3 3])
Output:
Simulation Exercise:
1. Obtain Nyquist Plot of the following transfer function using MATLAB:
2
G ( s )=
S ( S +2 ) (S+ 4) . Comment on stability of the system.
2. Obtain Nyquist Plot of the following transfer function using MATLAB:
(S +2)
G ( s )=
S ( S +2 ) ( S+ 5 ) (S +20) . Comment on stability of the system.
Conclusion:
Quiz:
1. Explain polar plot.
2. What is Nyquist contour?
3. What is Nyquist Mapping
Rubrics 1 2 3 4 5 Total
Marks
Rubrics:
1. Understand objectives of experiment.
2. Effective use of soft computing tools.
3. Question answer during lab session.
4. Outcome analysis and conclusion writing ability.
5. Submission in time.
References: https://www.mathworks.com/
Date:
Before the concept of state space analysis of control system, it is very important to discuss here the
differences between the conventional theory of control system and modern theory of control
system.
The conventional control theory is completely based on the frequency domain approach while the
modern control system approach is based on time domain approach.
In the conventional theory of control system we have linear and time invariant single input single
output (SISO) systems only but with the help of theory of modern control system we can easily do
the analysis of even nonlinear and time variant multiple inputs multiple outputs (MIMO) systems
also.
In the modern theory of control system the stability analysis and time response analysis can be
done by both graphical and analytically method very easily.
Now state space analysis of control system is based on the modern theory which is applicable to all
types of systems like single input single output systems, multiple inputs and multiple outputs
systems, linear and nonlinear systems, time varying and time invariant systems. Let us consider
few basic terms related to state space analysis of modern theory of control systems.
State in State Space Analysis: It refers to smallest set of variables whose knowledge at t=t0together
with the knowledge of input for t ≥ t0 gives the complete knowledge of the behavior of the system
at any time t ≥ t0.
State Variables in State Space analysis: It refers to the smallest set of variables which help us to
determine the state of the dynamic system. State variables are defined by x1(t), x2(t) Xn(t).
State Vector : Suppose there is a requirement of n state variables in order to describe the complete
behavior of the given system, then these n state variables are considered to be n components of a
vector x(t). Such a vector is known as state vector.
State Space : It refers to the n dimensional space which has x1 axis, x2axis,…., xn axis.
These variables are related by a set of equations which are written below and are known as state
space equations
Inverse of matrix can substitute by adj of matrix divided by the determinant of the matrix, now
on rewriting the expression we have of
Y (s ) s
= 3
U (s ) s +14 s +56 s+160
2
Program:
num=[0 0 4 16 12];
den=[1 12 44 48 0];
[A B C D]=tf2ss(num,den)
Output:
>> A
A=
1 0 0 0
0 1 0 0
0 0 1 0
>> B
B=
>> C
C=
0 4 16 12
>> D
D=
0
For below given state space model:
[ x 1 ¿ ][ x 2 ¿] ¿ ¿ ¿
. .
¿
[]
x1
y= [ 1 0 0 ] x 2
x3
Program:
A= [0 1 0; 0 0 1; -5 -25 -5];
C= [1 0 0];
D= [0];
[num,den]=ss2tf(A,B,C,D);
(num,den);
printsys
Output:
>>num
num =
0 0.0000 25.0000 5.0000
>>den
den =
1.0000 5.0000 25.0000 5.0000
num/den =
8.8818e-015 s^2 + 25 s + 5
--------------------------
s^3 + 5 s^2 + 25 s + 5
Simulation Exercise:
1. RepresentfollowingsysteminstatespaceusingMATLAB.Alsoverifyresults.
20
G ( S )=
(S+ 2)( S+3)
2. Find thetransfer function forthe system 𝑥̇=𝐴𝑥+𝐵𝑢𝑎𝑛𝑑𝑦=𝑐𝑥with
A=
[ 0
−2 −3 ] []
1 0
, B= , A=[ 0 ] 1, D= [ 0 ].
2
Conclusion:
Quiz:
1. What is a state variable?
2. What is state space?
3. What is a state equation?
Rubrics 1 2 3 4 5 Total
Marks
Rubrics:
1. Understand objectives of experiment.
2. Effective use of soft computing tools.
3. Question answer during lab session.
4. Outcome analysis and conclusion writing ability.
5. Submission in time.
References: https://www.mathworks.com/
Experiment No: 12
To find zeros and poles from transfer function and vice versa by MATLAB.
Date:
Theory:
Find the zeros and poles of transfer function using matlab.
2
4 s +16 s+12
G ( S )=4 3 2
s +12 s +44 s + 48 s
Program:
num=[0 0 4 16 12];
den=[1 12 44 48 0];
[z,p,k]=tf2zp(num,den)
Output:
>>z
z=
-3
-1
>>p
p=
0
-6.0000
-4.0000
-2.0000
>>k
k=
4
Find the transfer function using zero, pole and gain k using Matlab.
There is no zero, poles are at -1+2j and -1-2j, k=10
Program:
z=[];
p=[-1+2*j;-1-2*j];
k=10;
[num,den]=zp2tf(z,p,k)
Y=tf(num,den)
Output:
num/den =
10
-------------
s^2 + 2 s + 5
Find the transfer function using zero, pole and gain k using Matlab.
There is a zero at 0, poles are at -1+2j and -1-2j, k=10
Program:
z=[0];
p=[-1+2*j;-1-2*j];
k=10;
[num,den]=zp2tf(z,p,k)
printsys(num,den)
Output:
num/den =
10 s
-------------
s^2 + 2 s + 5
Find the transfer function using zero ,pole and gain k using Matlab
There is a zero at -1, poles are at-2,-4 and -8, k=12
Program:
z=[-1];
p=[-2;-4;-8];
k=12;
[num,den]=zp2tf(z,p,k)
printsys(num,den)
Output:
num/den =
12 s + 12
------------------------
s^3 + 14 s^2 + 56 s + 64
Quiz:
1. Explain poles and zeros of the system?
2. Discuss how location of poles affects system stability.
3. Explain effects of zeros on system dynamics.
Rubrics 1 2 3 4 5 Total
Marks
Rubrics:
1. Understand objectives of experiment.
2. Effective use of virtual simulator.
3. Question answer during lab session.
4. Outcome analysis and conclusion writing ability.
5. Submission in time.
References: https://www.mathworks.com/