Professional Documents
Culture Documents
AFFILIATED TO
INDEX
2 Determine transpose, inverse values of given matrix. SOFT CO1 100 min
Plot the pole-zero configuration in s-plane for the given transfer
3 SOFT CO2 100 min
function.
Determine the transfer function for given closed loop system in
4 SOFT CO3 100 min
block diagram representation.
Plot unit step response of given transfer function and finds delay
5 SOFT CO3 100 min
time, rise time, peak time and peak overshoot.
Determine the time response of given system subjected to any
6 SOFT CO3 100 min
arbitrary input.
Plot root locus of given transfer function, locate closed loop poles
7 SOFT CO2 100 min
for different values of k.
8 Determine the steady state errors of a given transfer function. SOFT CO4 100 min
Plot bode plot of given transfer function. Also determine the
9 SOFT CO5 100 min
relative stability by measuring gain and phase margins.
Plot Nyquist plot for given transfer function and to discuss closed
10 loop stability. Also determine the relative stability by measuring SOFT CO5 100 min
gain and phase margin.
(Lab In-charge)_______________
Course Outcome (CO) :
At the end of this course, the student will be able to:
CO1 : Understand different toolboxes in MatLab and analyze various parameters of a matrix using MatLab.
CO2 : Locate poles and zeros for a given transfer function.
CO3 : Evaluate the various parameters of transient analysis of a control system.
CO4 : Evaluate the various parameters of steady state analysis of a control system.
CO5 : Examine the stability criteria for a control system using Bode and Nyquist plot.
Control System Lab [KEC-652]
EXPERIMENT NO.-1
Theory: MATLAB is software package which is being used by the scientific and engineering
community all over the world. This is one of the most versatile and user – friendly software
useful for solving large and complex problem.
MATLAB is developed by The Math Work Inc., stands for matrix Laboratory. It is a software
package used to perform scientific computations and visualization. Its capability for analysis of
various scientific problems, flexibility and powerful graphics makes it a very useful software
package. It provides an integrated Development Environment (IDE) for programming with
numerous predefined functions for technical computations and visualization. Besides available
built-in-functions, user-defined functions can also be included which can be used just like any
other built-in-function.
It provide collections of functions that act as tools for specific applications such as control
system Design, power systems, Design , Power system, Digital Signal Processing.
MATLAB includes C and C++ Math libraries that support the development of stand -alone
applications. It provides an external interface to run FORTRAN, C and C++ programs from
within MATLAB programs. It also acts as the foundation for powerful simulation software such
as simulink and stateflow. Moreover, more than 125 third-party software product and services
have interface with MATLAB.
As the name MATLAB comes from the two words ‘MAT’, which stand for Matrix, and ‘LAB’,
which stands for Laboratory, MATLAB is Matrix Laboratory implying that it deals in matrices.
Aerospace Toolbox
Antenna Toolbox
Mapping Toolbox
Datafeed Toolbox
Financial Toolbox
Communications Toolbox
Embedded Coder
You can tune compensator parameters using interactive techniques such as Bode loop shaping
and the root locus method. The toolbox automatically tunes both SISO and MIMO
compensators, including PID controllers. Compensators can include multiple tunable blocks
spanning several feedback loops. You can tune gain-scheduled controllers and specify multiple
tuning objectives, such as reference tracking, disturbance rejection, and stability margins. You
ECE Department, Prepared By Checked By
SRMCEM, LKO Page 3 of 44
can validate your design by verifying rise time, overshoot, settling time, gain and phase margins,
and other requirements.
Key Features
➢ Step response, Nyquist plot, and other time-domain and frequency-domain tools for
analyzing stability and performance.
➢ Automatic tuning of PID, gain-scheduled, and arbitrary SISO and MIMO control systems.
➢ Root locus, Bode diagrams, LQR, LQG, and other classical and state-space design
techniques.
EXPERIMENT NO.2
Object: Determine transpose, inverse values of given matrix using MATLAB. Also find the
rank, determinant, Eigen values, Eigen vector, trace and ortho-normal of the same matrix.
1 10 20
A= 2 5 7
7 8 9
Introduction of matrix: The matrix notation usually simplifies the complex mathematical
expression and makes solution of problems much easier to handle and manipulate. In MATLAB,
a matrix is a rectangular array of real or complex numbers. Matrices with only one row or with
only one column are called row and column vectors respectively. A matrix having only one
element is called a scalar. Some operations are performed on the matrices as given below.
1) Transpose: The transpose a matrix is a new matrix in which the rows of the original
matrix are the columns of the new matrix.
2) Inverse: The matrix B is the inverse of the matrix A when the two matrices are
multiplied and the product is an identity matrix. Both matrices A & B must be square and
the order of multiplication can be AB or BA.
AB=BA=I
3) Rank: The rank function provides an estimate of the number of linearly independent
rows or columns of a full matrix
Syntax: Lamda=eig(A)
With the eigenvalues on the diagonal of a diagonal matrix Λ and the corresponding
eigenvectors forming the columns of a matrix V, you have
AV = VΛ.
If V is nonsingur
6) Eigen Vector:
This syntax returns the sum of the diagonal elements of the matrix A.
The syntax of orthonormal basis for the range of A. The columns of B span the same
space as the columns of A, and the columns of B are orthogonal, so that B'*B =
eye(rank(A)). The number of columns of B is the rank of A.
Program:
clearall
clc
Results:All the operations have been performed taking a 3*3 matrix A using MATLAB and
results have been seen on the command window.
Precautions:
EXPERIMENT NO. 3
Object: Plot the pole-zero configuration in s-plane for the given transfer function using MATLAB.
Theory: The transfer function provides a basis for determining important system response
characteristics without solving the complete differential equation. As defined, the transfer function is a
rational function in the complex variable
It is often convenient to factor the polynomials in the numerator and denominator, and to write the
transfer function in terms of those factors
where the numerator and denominator polynomials, N(s)and D(S) have real coefficients definedby the
system’s differential equation and K is gain. As written in Eq. (2), the zi’sand pi’s are the poles and zeros
respectively with the equations
N (s) = 0
D(s) = 0
Program:
%Plot the pole-zero configuration in s-plane for the given transfer function
G(s)= (5s^2 + 15s + 10)/(2s^4 + 7s^3 + 20s^2 + 24s)
clearall
clc
% Transfer Function
ltiview(G)
Results:
n=
5 15 10
d=
2 7 20 24 0
Transfer function:
5 s^2 + 15 s + 10
-----------------------------
Zero/pole/gain:
--------------------------------
z=
-2
-1
p=
-0.8852 + 2.4808i
-0.8852 - 2.4808i
-1.7296
k=
2.5000
n1 =
d1 =
Pole-Zero Map
2
Imaginary Axis (seconds-1)
-1
-2
-3
Precautions:
ECE Department, Prepared By Checked By
SRMCEM, LKO Page 11 of 44
EXPERIMENT NO.4
Objective: Determine the transfer function for given closed loop system in block diagram
representation.
The block diagram shown in figure 4.1 is showing the parallel, series and feedback
connections. By using the rules of block diagram reduction, the closed loop block
diagram can be reduced to single block which gives the overall transfer function of the
system.
10
Input(R) Ei Eo2 + Eo Output(C)
5 1/s(s+1)
+ +
-
Program
diagram representation.
clear all
clc
syms s t
Denominator of
d1=[0 1]; % G1
G1=tf(n1,d1,'inputname','Ei','outputname','Eo
1')
n2=[5]; % Numerator of G2
Denominator of
d2=[1]; % G2
n3=[1]; % Numerator of G3
% Denominator of
d3=[1 1 0]; G3
n4=[1]; % Numerator of H1
% Denominator of
d4=[1]; H1
% Determining the
H1=tf(n4,d4,'inputname','C','outputname','B') H1
[n5,d5]=parallel(n1,d1,n2,d2);
G_12=tf(n5,d5,'inputname','Ei','outputname',' Paralle
Eo') % l
Combinatio
n of G1
and G2
[n6,d6]=series(n5,d5,n3,d3);
G_forward=tf(n6,d6,'inputname','Ei','outputname','C')%SeriesCombination of
G_12 and G3
[n7,d7]=feedback(n6,d6,n4,d4);
Function
Transfer Function
Results:
1
s^2 + s
Transfer function from input "C" to output "B":
1
Transfer function from input "Ei" to output "Eo":
s+5
Transfer function from input "Ei" to output "C":
s+5
-------
s^2 + s
Transfer function from input "R" to output "C":
s+5
-------------
s^2 + 2 s + 5
Pole-Zero Map
is (seconds-1)
2.5
1.5
0.5
-0.5
-1
-1.5
-2
-2.5
-5 -4 -3 -2 -1 0
Precautions:
1) Program must be written carefully to avoid errors.
2) Programs can never be saved as standard function name.
3) Functions in MATLAB case sensitive so commands must be written in proper
form
EXPERIMENT NO. 5
Objective: Plot unit step response of given transfer function and finds delay time, rise
time, peak time and peak overshoot.
For linear control systems, the characterization of the transient response is often done by
use of the unit-step function us(t) as the input. The response of a control system when the
input is a unit-step function is called the unit-step response. Figure 5.1 illustrates a typical
unit-step response of a linear control system. With reference to the unit-step response,
performance criteria commonly used for the characterization of linear control systems in
the time domain are defined as follows:
Figure 5.1: Typical unit-step response of a control system illustrating the time-domain
specifications.
ECE Department, Prepared By Checked By
SRMCEM, LKO Page 18 of 44
Maximum overshoot: Let y(t) be the unit-step response. Let ymax denote the maximum
value of y(t); yss, the steady-state value of y(t); and ymax > yss. The maximum overshoot
of y(t) is defined as maximum overshoot = ymax - yss.
The maximum overshoot is often represented as a percentage of the final value of the step
response; that is,
MaximumOvershoot
Percentage Maximum Overshoot = 100% (5.1)
y
ss
The maximum overshoot is often used to measure the relative stability of a control
system.
Delay time: The delay time td is defined as the time required for the step response to
reach 50% of its final value. This is shown in Figure 9.1.
Rise time. The rise time tr is defined as the time required for the step response to rise
from 10 to 90% of its final value, as shown in Figure 9.1.
Settling time: The settling time ts is defined as the time required for the step response to
decrease and stay within a specified percentage of its final value. A frequently used
figure is 5%. The four quantities just defined give a direct measure of the transient
characteristics of a control system in terms of the unit-step response. These time-domain
specifications are relatively easy to measure when the step response is well defined, as
shown in Figure 9.1. Analytically, these quantities are difficult to establish, except for
simple systems lower than the third order.
Program:
clear all
clc
syms s t
n=[25]
d=[1 6 25]
sys = tf(n,d)
R=roots(d)
S = stepinfo(sys,'RiseTimeLimits',[0.00,1.00])
ltiview(sys)
Results:
n=
25
d=
1 6 25
ECE Department, Prepared By Checked By
SRMCEM, LKO Page 20 of 44
Transfer function:
25
--------------
s^2 + 6 s + 25
R=
-3.0000 + 4.0000i
-3.0000 - 4.0000i
S=
RiseTime: 0.5538
SettlingTime: 1.1886
SettlingMin: 0.9910
SettlingMax: 1.0948
Overshoot: 9.4778
ECE Department, Prepared By Checked By
SRMCEM, LKO Page 21 of 44
Undershoot: 0
Peak: 1.0948
PeakTime: 0.7869
Precautions:
EXPERIMENT 6
Objective: Determine the time response of the given system subjected to any
arbitrary input.
clear all;
close all;
h1=tf([9],[1 6 9])
subplot(3,2,1);
subplot(3,2,2);
impulse(h1);
r=sin(t);
s=2*t;
subplot(3,2,3);
subplot(3,2,4);
subplot(3,2,5);
lsim(h1,q,t);
Output
9
h1 = ------------------
s^2 + 6 s + 9
Continuous-time transfer function.
Results
Precautions
EXPERIMENT NO. 7
Objective: Plot root locus of given transfer function, locate closed loop poles for
different values of k.
Introduction of Root Locus: The root locus of an (open-loop) transfer function H(s) is a
plot of the locations (locus) of all possible closed-loop poles with proportional gain K and
unity feedback.
Y(s) KH (s)
= (9.1)
R (s) 1+ K H(s)
and thus the poles of the closed-loop system are values of such that 1 + K H(s) =0
b(s)
H (s) =
If we write a(s) , then this equation has the form:
ECE Department, Prepared By Checked By
SRMCEM, LKO Page 27 of 44
a(s)
+ b(s) = 0 (9.3)
K
Let n = order of a(s) and m = order of b(s) (the order of a polynomial is the highest power
of that appears in it).
We will consider all positive values of K. In the limit as K → 0 , the poles of the closed-
loop system are a(s) = 0 or the poles of H(s). In the limit as K → 0 , the poles of the
closed-loop system are b(s) = 0 or the zeros of H(s).
No matter what we pick K to be, the closed-loop system must always have poles, where
is the number of poles of H(s). The root locus must have n branches; each branch starts
at a pole of H(s) and goes to a zero of H(s). If H(s) has more poles than zeros (as is often
the case), m n and we say that H(s) has zeros at infinity. In this case, the limit of H(s).
as s → is zero. The number of zeros at infinity is n − m, the number of poles minus the
number of zeros, and is the number of branches of the root locus that go to infinity
(asymptotes).
Since the root locus is actually the locations of all possible closed-loop poles, from the
root locus we can select a gain such that our closed-loop system will perform the way we
want. If any of the selected poles are on the right half plane, the closed-loop system will
be unstable. The poles that are closest to the imaginary axis have the greatest influence on
the closed-loop response, so even though the system has three or four poles, it may still
act like a second or even first order system depending on the location(s) of the dominant
pole(s).
Problem Statement:
Y (s) (s+ 7)
H (s) = = (9.4)
U (s) s(s+ 5)(s+ 15)(s+ 20)
How do we design a feedback controller for the system by using the root locus method?
Say our design criteria are 5% overshoot and 1 second rise time.
Program:
s = tf('s');
rlocus(sys)
Zeta = 0.7;
Wn = 1.8;
sgrid(Zeta,Wn)
[k,poles] = rlocfind(sys)
Results: Root locus for a given transfer function is obtained as well as the pole location for a
given gain is determined.
Precautions
[Type text]
ECE Department, Prepared By Checked By
SRMCEM, Lko Page 31 of 44
EXPERIMENT NO. 8
Consider the following block diagram of closed loop control system, which is having unity
negative feedback.
Where,
⇒C(s)=R(s)G(s)1+G(s)⇒C(s)=R(s)G(s)1+G(s)
⇒E(s)=R(s)+R(s)G(s)−R(s)G(s)1+G(s)⇒E(s)=R(s)+R(s)G(s)−R(s)G(s)1+G(s)
⇒E(s)=R(s)1+G(s)⇒E(s)=R(s)1+G(s)
Program
[Type text]
ECE Department, Prepared By Checked By
SRMCEM, Lko Page 32 of 44
clc
clear all
close all
h=tf([4],[1 3 4]);
a=step(h);
[y,t]=step(h);
i=length(y)
z=y(i)
c=y(end)
sserror=abs(1-c)
Output
4
h = -------------------
s^2 + 3 s + 4
i=
139
z=
0.9999
c=
0.9999
sserror =
1.1622e-04
Precautions:
[Type text]
ECE Department, Prepared By Checked By
SRMCEM, Lko Page 33 of 44
[Type text]
ECE Department, Prepared By Checked By
SRMCEM, Lko Page 34 of 44
EXPERIMENT NO. 9
Objective: Plot bode plot of given transfer function. Also determine the relative
stability by measuring gain and phase margins.
Theory: The Bode plot of a transfer function is a very useful graphical tool for the
analysis and design of linear control systems in the frequency domain. Before the
inception of computers, Bode plots were often called the “asymptotic plots,” because the
magnitude and phase curves can be sketched from their asymptotic properties without
detailed plotting. Modern applications of the Bode plot for control systems should be
identified with the following advantages.
2. Gain crossover, phase crossover, gain margin, and phase margin are more easily
determined on the Bode plot than from the Nyquist plot.
3. For design purposes, the effects of adding controllers and their parameters are
more easily visualized on the Bode plot than on the Nyquist plot.
1
[Type text]
ECE Department, Prepared By Checked By
SRMCEM, Lko Page 35 of 44
The following observations can be made on system stability with respect to the properties
of the Bode plot:
1. The gain margin is positive and the system is stable if the magnitude of L(jω) at
the phase crossover is negative in dB. That is, the gain margin is measured below
the 0-dB-axis. If the gain margin is measured above the 0-dB-axis, the gain
margin is negative, and the system is unstable.
2. The phase margin is positive and the system is stable if the phase of L(jω) is
greater than -180° at the gain crossover. That is, the phase margin is measured above
the -180°-axis. If the phase margin is measured below the -180°-axis, the phase
margin is negative, and the system is unstable.
Figure 9.1: Determination of gain margin and phase margin on the Bode plot.
[Type text]
ECE Department, Prepared By Checked By
SRMCEM, Lko Page 36 of 44
Program
clear all
clc
n = [50];
d = [1 9 30 40];
sys = tf(n,d)
w = logspace(-
1,2,4) bode(sys)
grid;
[a,phase] = bode(sys,w);
mag = 20*log10(a);x =
w';
[G_Margin,P_Margin,w_phase_crossover,w_gain_crossover] =
margin(sys)
Gain_Margin_dB = 20*log10(G_Margin)
for i = 1:4
[Type text]
ECE Department, Prepared By Checked By
SRMCEM, Lko Page 37 of 44
end
Results
Transfer function:
50
-----------------------
s^3 + 9 s^2 + 30 s + 40
w=
4.6019
P_Margin =
100.6674
w_phase_crossover =
5.4782
W_gain_crossover =
[Type text]
ECE Department, Prepared By Checked By
SRMCEM, Lko Page 38 of 44
1.8483
Precautions:
1) Program must be written carefully to avoid errors.
[Type text]
ECE Department, Prepared By Checked By
SRMCEM, Lko Page 39 of 44
EXPERIMENT NO. 10
Objective: Plot the Nyquist plot for given transfer function and to discuss closed loop
stability. Also determine the relative stability by measuring gain and phase margin.
C (s) G(s)
=
R (s) 1+ G(s) H(s)
For stability, all the roots of the characteristic equation 1+GH(s) = 0 must lie in the left-
half plane.
• Note that open loop transfer function of a stable system may have poles in the left
half plane
[Type text]
ECE Department, Prepared By Checked By
SRMCEM, Lko Page 40 of 44
• Nyquist stability criteria relates the open-loop transfer functions and the poles of
the characteristic function.
• Let F(s) denotes a complex function that is a ration of two polynomials, i.e.
𝑃𝑜𝑙𝑦𝑛𝑜𝑚𝑖𝑎𝑙1
𝐹 (s) =
𝑃𝑜𝑙𝑦𝑛𝑜𝑚𝑖𝑎𝑙2
➢
A contour encompassing BUT NOT PASSING through any number of
zeros and poles of a function F(s), can be mapped to another plane (the
F(s) plane) by the function F(s).
➢
The resulting contour ΓF(s) will encircle the origin of the F(s) plane N
times, where N = Z - P, where Z and P are respectively the number of
zeros and poles of F(s) inside the contour Γs.
• Note that we count encirclements in the F(s) plane in the same sense as the
contour Γs and that encirclement in the opposite direction are negative
encirclements.
[Type text]
ECE Department, Prepared By Checked By
SRMCEM, Lko Page 41 of 44
• For stability analysis of closed loops systems, the chosen complex contour should
cover the entire right half plane.
• For stability analysis, we need to check if 1+GH(s) has any zeros in the RHP or
not. Noting that only difference between mapping 1+GH(s) and mapping GH(s) is
the addition of one, which is equivalent to a linear shift in the origin.
• Hence, we can use the mapped Nyquist contour of the open loop to to investigate
the stability of the closed loop system.
• Before delving into the details of the stability analysis procedure, it is important to
point out the following facts
[Type text]
ECE Department, Prepared By Checked By
SRMCEM, Lko Page 42 of 44
➢
the zeros of 1 + GH(s) are the poles of the closed-loop system, and
➢
the poles of 1 + GH(s) are same as the poles of G(s)
Program
clear all
clc
k = 10;
s = tf(‘s’);
GH =k/(s*(1+0.5*s)*(1+0.02*s))
Nyquist(GH)
[Gm,Pm,Wcp,Wcg] = margin(GH)
disp(Gm)
disp(Pm)
disp(Wcp)
disp(Wcg)
grid on;
Results
Transfer function:
10
-----------------------
0.01 s^3 + 0.52 s^2 + s
Gm =
5.2000
Pm =
20.3681
Wcp =
10.0000
Wcg =
4.2460
Gain Margin is
5.2000
Phase Margin is
20.3681
Nyquist Diagram
100
0 dB
80
60
40
20
Real Axis
Precautions:
1) Program must be written carefully to avoid errors.
2) Programs can never be saved as standard function name.
3) Functions in MATLAB case sensitive so commands must be written in proper
format.