You are on page 1of 53

LAB MANUAL

CONTROL SYSTEM LAB


[KEC 652]
DEPARTMENT
OF
ELECTRONICS AND COMMUNICATION
ENGINEERING

SHRI RAM SWAROOP MEMORIAL GROUP


OF PROFESSIONAL COLLEGES,
LUCKNOW, UP

AFFILIATED TO

Dr. A. P. J. ABDUL KALAM UNIVERSITY


SHRI RAMSWAROOP MEMORIAL GROUP OF PROFESSIONAL COLLEGES
B.Tech. (EC) SEM VI (2019-20)

Control System Lab (KEC-652)

INDEX

S. Name of the Experiment Type of Course Average Time


No. Experiment Outcome of
(CO) Completion
(in minutes)
Different Toolboxes in MATLAB, Introduction to Control Systems
1 SOFT CO1 100 min
Toolbox.

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.

SOFT : Software based MATLAB 7.9

Signature of the Faculty: Signature of the HOD:

(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

Object: To study the basic of MATLAB, Different Toolboxes in MATLAB,


and Introduction to Control Systems Toolbox.

Software used: MATLAB 7.9

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.

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 1 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

Various types of tool box available in MATLAB as shown below:-

Aerospace Toolbox

Antenna Toolbox

Statistics and Machine Learning Toolbox

Curve Fitting Toolbox

Control System Toolbox

Signal Processing Toolbox

Mapping Toolbox

System Identification Toolbox

Deep Learning Toolbox

DSP System Toolbox

Datafeed Toolbox

Financial Toolbox

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 2 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

Image Processing Toolbox

Text Analytics Toolbox

Predictive Maintenance Toolbox

Communications Toolbox

Embedded Coder

Filter Design HDL Coder

Robotics System Toolbox

Introduction to Control Toolbox:-


Control System Toolbox™ provides algorithms and apps for systematically analyzing,
designing, and tuning linear control systems. You can specify your system as a transfer function,
state-space, zero-pole-gain, or frequency-response model. Apps and functions, such as step
response plot and Bode plot, let you analyze and visualize system behavior in the time and
frequency domains.

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

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

can validate your design by verifying rise time, overshoot, settling time, gain and phase margins,
and other requirements.

Key Features

➢ Transfer-function, state-space, zero-pole-gain, and frequency-response models of linear


systems.

➢ 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.

➢ Model representation conversion, continuous-time model discretization, and low-order


approximation of high-order systems.

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 4 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

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 

Apparatus Used: MATLAB with Control System Toolbox.

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.

Syntax: B=transpose (A)

This syntax returns the transpose of a given matrix A.

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

Syntax: B=inv (A)

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 5 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

3) Rank: The rank function provides an estimate of the number of linearly independent
rows or columns of a full matrix

Syntax: k = rank (A)

This syntax returns the number of singular values of A.

4) Determinant: A determinant is a scalar computed from the entries in a square matrix.

Syntax: d = det (A)

This syntax returns the determinant of the square matrix A.

5) Eigen Value & Eigen Vector:

Syntax: Lamda=eig(A)

An eigenvalue and eigenvector of a square matrix A are, respectively, a scalar λ and a


nonzero vector υ that satisfyAυ = λυ.

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:

Syntax: [V, D]=eig(A)

7) Trace: Sum of diagonal elements.

Syntax: C = trace (A)

This syntax returns the sum of the diagonal elements of the matrix A.

8) Orthonormal: Range space of matrix.

Syntax: B = orth (A)


ECE Department, Prepared By Checked By
SRMCEM, LKO Page 6 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

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

A=[1 10 20;2 5 6;7 8 9]; %Take any matrix A

Determinant_A=det(A); %Determinant of Matrix A

Rank_A=rank(A); %Rank of Matrix A

Trace_A=trace(A); %Trace of Matrix A

Square_A=A*A; %Square of Matrix A

Transpose_A=transpose(A); %Transpose of Matrix A

Inverse_A=inv(A); %Inverse of Matrix A

Eigenvalue_A=eig(A); %Eigen Values of Matrix A

[v x]=eig(A); %Eigen Vector of Matrix A

Orthogonal_A=orth(A); %Orthogonal Matrix of Matrix A

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:

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.

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 7 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

EXPERIMENT NO. 3

Object: Plot the pole-zero configuration in s-plane for the given transfer function using MATLAB.

Apparatus Used: MATLAB with Control System Toolbox.

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

N ( s) an s m + am−1s m−1 + ........ + a1s + a0


H ( s) = = (3.1)
D(s) bn s n + bn−1s n−1 + ........ + b1s + b0

It is often convenient to factor the polynomials in the numerator and denominator, and to write the
transfer function in terms of those factors

N (s) K (s − z1 )(s − z2 )...........(s − zm−1 )(s − zm )


H ( s) = = (3.2)
D(s) (s − p1 )(s − p2 )...........(s − pn−1 )(s − pn )

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)

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 8 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

clearall

clc

n=[5 15 10]; %Numerator array of Transfer Function

%n=input('Enter the numerator vector:')

d=[2 7 20 24 0]; %Denominator array of Transfer Function

%d=input('Enter the denominator vector:')

Transfer_Function=tf(n,d) %Determining the Transfer Function

G=zpk(Transfer_Function) %Converts the Transfer Function into

%the format showing in pole, zero and gain


%form

[z,p,k]=tf2zp(n,d) %Provides the values of Zeros(z),

%Poles(p) and Gain constant for

% Transfer Function

[n1,d1]=zp2tf(z,p,k) %Provides the Numerator and

% Denominator arrays of Transfer

%Function from the values of


% Zeros(z), Poles(p) and Gain constant

pzmap(n,d) %Plot the poles and zeros on s-plane

ltiview(G)

Results:
n=

5 15 10

d=

2 7 20 24 0

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 9 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

Transfer function:

5 s^2 + 15 s + 10

-----------------------------

2 s^4 + 7 s^3 + 20 s^2 + 24 s

Zero/pole/gain:

2.5 (s+2) (s+1)

--------------------------------

s (s+1.73) (s^2 + 1.77s + 6.938)

z=

-2

-1

p=

-0.8852 + 2.4808i

-0.8852 - 2.4808i

-1.7296

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 10 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

k=

2.5000

n1 =

0 0 2.5000 7.5000 5.0000

d1 =

1.0000 3.5000 10.0000 12.0000 0

Pole-Zero Map

2
Imaginary Axis (seconds-1)

-1

-2

-3

-3 -2.5 -2 -1.5 -1 -0.5 0 0.5 1


-1
Real Axis (seconds )

Figure 3.1: Pole-Zero Plot for the given transfer function

Precautions:
ECE Department, Prepared By Checked By
SRMCEM, LKO Page 11 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

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.

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 12 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

EXPERIMENT NO.4
Objective: Determine the transfer function for given closed loop system in block diagram
representation.

Apparatus Used: MATLAB with Control System Toolbox.


Theory: If a given system is complicated, it is very difficult to analyze it as a whole. With the
help of transfer function approach, we can find transfer function of each and every element of the
complicated system. And by showing connection between the elements, complete system can be
splitted into different blocks and can be analyzed conveniently. This is the basic concept of 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)
+ +
-

Figure 4.1: Block Diagram of a Control System

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 13 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

Program

%Determine the transfer function for given closed loop system in


block

diagram representation.

%Transfer Functions: G1 = 5, G2 = s, G3= 1/(s^2


+ s), H1=1

clear all

clc

syms s t

n1=[1 0]; % Numerator of G1

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

G2=tf(n2,d2,'inputname','Ei','outputname','Eo % Determining the


2') G2

n3=[1]; % Numerator of G3

% Denominator of
d3=[1 1 0]; G3

G3=tf(n3,d3,'inputname','Eo','outputname','C' % Determining the


) G3

n4=[1]; % Numerator of H1

% Denominator of
d4=[1]; H1

% Determining the
H1=tf(n4,d4,'inputname','C','outputname','B') H1

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 14 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

[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);

G_overall=tf(n7,d7,'inputname','R','outputname','C') % Overall Transfer

Function of Closed Loop


Transfer

Function

pzmap(G_overall) % To plot poles and zeros of


Overall

Transfer Function

Results:

Transfer function from input "Ei" to output "Eo1":


s
Transfer function from input "Ei" to output "Eo2":
5

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 15 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

Transfer function from input "Eo" to output "C":

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

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 16 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

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

Real Axis (seconds-1)

Figure 4.2: Pole-Zero Plots for the given transfer function

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

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 17 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

EXPERIMENT NO. 5

Objective: Plot unit step response of given transfer function and finds delay time, rise
time, peak time and peak overshoot.

Apparatus Used: MATLAB with Control System Toolbox.


Theory: The transient portion of the time response is the part that goes to zero as time
becomes large. Nevertheless, the transient response of a control system is necessarily
important, because both the amplitude and the time duration of the transient response
must be kept within tolerable or prescribed limits.

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

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

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.

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 19 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

Program:

% Plot unit step response of given transfer function and find


peak overshoot, peak time, rise time and delay time using MATLAB.

% Transfer Function = 25/(s^2+6s+25)

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

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

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

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

Undershoot: 0

Peak: 1.0948

PeakTime: 0.7869

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 22 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

Figure 5.2: Step Response for the given transfer function

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.

EXPERIMENT 6
Objective: Determine the time response of the given system subjected to any
arbitrary input.

Apparatus Used: MATLAB with Control System Toolbox.


Theory: The time response has utmost importance for the design and analysis of control
systems because these are inherently time domain systems where time is independent variable.
During the analysis of response, the variation of output with respect to time can be studied and it
is known as time response. To obtain satisfactory performance of the system with respect to time
must be within the specified limits. From time response analysis and corresponding results, the
stability of system, accuracy of system and complete evaluation can be studied easily. Due to the
application of an excitation to a system, the response of the system is known as time response
and it is a function of time. The two parts of response of any system:
Program

clear all;

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 23 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

close all;

h1=tf([9],[1 6 9])

t=linspace(1,15); %STEP RESPONSE%

subplot(3,2,1);

step(h1); %IMPULSE RESPONSE%

subplot(3,2,2);

impulse(h1);

r=sin(t);

s=2*t;

q=5*(t.^2); %SINE RESPONSE%

subplot(3,2,3);

lsim(h1,r,t); %RAMP RESPONSE%

subplot(3,2,4);

lsim(h1,s,t); %PARABOLIC RESPONSE%

subplot(3,2,5);

lsim(h1,q,t);

Output
9
h1 = ------------------
s^2 + 6 s + 9
Continuous-time transfer function.

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 24 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

Results

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 25 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

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.

EXPERIMENT NO. 7

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 26 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

Objective: Plot root locus of given transfer function, locate closed loop poles for
different values of k.

Apparatus Used: MATLAB with Control System Toolbox.

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.

Figure 9.1: Block Diagram of a Control System

The closed-loop transfer function is:

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

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

a (s) + Kb(s) = 0 (9.2)

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).

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 28 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

Problem Statement:

Consider an open-loop system which has a transfer function of

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:

% Plot root locus of given transfer function, locate closed loop


poles for different values of k.

% sys = (s + 7)/(s*(s + 5)*(s + 15)*(s + 20));

s = tf('s');

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 29 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

sys = (s + 7)/(s*(s + 5)*(s + 15)*(s + 20));

rlocus(sys)

axis([-22 3 -15 15])

Zeta = 0.7;

Wn = 1.8;

sgrid(Zeta,Wn)

[k,poles] = rlocfind(sys)

ECE Department, Prepared By Checked By


SRMCEM, LKO Page 30 of 44

Faculty In-charge Head of


Department
Control System Lab [KEC-652]

Results: Root locus for a given transfer function is obtained as well as the pole location for a
given gain is determined.

Figure 9.2: Root Locus of a given Control System

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.

[Type text]
ECE Department, Prepared By Checked By
SRMCEM, Lko Page 31 of 44

Faculty In-charge Head of Department


Control System Lab [KEC-652]

EXPERIMENT NO. 8

Objective: Determine the steady state errors of a given transfer function.

Apparatus Used: MATLAB with Control System Toolbox.


Theory Steady State Errors for Unity Feedback Systems

Consider the following block diagram of closed loop control system, which is having unity
negative feedback.

Where,

•R(s) is the Laplace transform of the reference Input signal r(t)r(t)


• C(s) is the Laplace transform of the output signal c(t)c(t)
We know the transfer function of the unity negative feedback closed loop control system as
C(s)R(s)=G(s)1+G(s)C(s)R(s)=G(s)1+G(s)

⇒C(s)=R(s)G(s)1+G(s)⇒C(s)=R(s)G(s)1+G(s)

The output of the summing point is -


E(s)=R(s)−C(s)

Substitute C(s)C(s) value in the above equation.


E(s)=R(s)−R(s)G(s)1+G(s)E(s)=R(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)

Substitute E(s) value in the steady state error formula


ess=lims→0sR(s)1+G(s)

Program
[Type text]
ECE Department, Prepared By Checked By
SRMCEM, Lko Page 32 of 44

Faculty In-charge Head of Department


Control System Lab [KEC-652]

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

Continuous-time transfer function.

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

Faculty In-charge Head of Department


Control System Lab [KEC-652]

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.

[Type text]
ECE Department, Prepared By Checked By
SRMCEM, Lko Page 34 of 44

Faculty In-charge Head of Department


Control System Lab [KEC-652]

EXPERIMENT NO. 9

Objective: Plot bode plot of given transfer function. Also determine the relative
stability by measuring gain and phase margins.

Apparatus Used: MATLAB with Control System Toolbox.

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.

Advantages of the Bode Plot


1. In the absence of a computer, a Bode diagram can be sketched by approximating
the magnitude and phase with straightline segments.

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

Gain Margin: GM = 20log  


10  G ( j )H ( j ) 
 pc pc 

[Type text]
ECE Department, Prepared By Checked By
SRMCEM, Lko Page 35 of 44

Faculty In-charge Head of Department


Control System Lab [KEC-652]

Phase Margin: P.M = 1800 + G ( j gc ) H ( jgc )

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

Faculty In-charge Head of Department


Control System Lab [KEC-652]

Program

% Plot bode plot of given transfer function and


find gain and phase margins using MATLAB.

% Transfer Function = 50/(s^3+9s^2+30s+40)

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)

disp('Frequency(rad/sec) Magnitude(dB) Phase(degree)')

for i = 1:4

fprintf('%f\t\t %f\t\t %f \n',x(i),mag(i),phase(i))

[Type text]
ECE Department, Prepared By Checked By
SRMCEM, Lko Page 37 of 44

Faculty In-charge Head of Department


Control System Lab [KEC-652]

end

Results
Transfer function:

50

-----------------------

s^3 + 9 s^2 + 30 s + 40

w=

0.1000 1.0000 10.0000 100.0000


G_Margin =

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

Faculty In-charge Head of Department


Control System Lab [KEC-652]

1.8483

Frequency(rad/sec) Magnitude(dB) Phase(degree)


0.100000 1.933311 -4.297362
1.000000 1.421852 -43.090848
10.000000 -26.918238 -219.143986
100.000000 -86.029718 -264.844124

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.

[Type text]
ECE Department, Prepared By Checked By
SRMCEM, Lko Page 39 of 44

Faculty In-charge Head of Department


Control System Lab [KEC-652]

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.

Apparatus Used: MATLAB with Control System Toolbox.

Theory: It is a graphical technique for determining the stability of linear time-invariant


system. Considering the closed loop system shown in Figure 10.1,

Figure 10.1: Closed Loop System


the transfer function is expressed as

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

Faculty In-charge Head of Department


Control System Lab [KEC-652]

• Nyquist stability criteria relates the open-loop transfer functions and the poles of
the characteristic function.

Cauchy's argument principle

• Let F(s) denotes a complex function that is a ration of two polynomials, i.e.
𝑃𝑜𝑙𝑦𝑛𝑜𝑚𝑖𝑎𝑙1
𝐹 (s) =
𝑃𝑜𝑙𝑦𝑛𝑜𝑚𝑖𝑎𝑙2

• Let (x; y) represent a point in the s-plane.

• By direct substitution of (x; y) in F(s), F(s) will take a complex value

• Consider now a contour Γs drawn in the complex s-plane, the by substituting of


all points on the contour in F(s), we get another contour in F(s) plane.

• The process described above is called contour mapping

• Cauchy argument principal states that


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.

Nyquist Stability Criteria

[Type text]
ECE Department, Prepared By Checked By
SRMCEM, Lko Page 41 of 44

Faculty In-charge Head of Department


Control System Lab [KEC-652]

• A Nyquist stability criterion is based on Cauchy's argument principle of complex


variables.

• For stability analysis of closed loops systems, the chosen complex contour should
cover the entire right half plane.

• Such path is called Nyquist path and consists of a semicircle starting at -∞ to ∞.

• By Cauchy Argument Principle, the mapped Nyquist contour in GH(s) -plane


makes a number of clock-wise encirclements around the origin equals the number
of zeros of GH(s) in the right-half complex plane minus the poles of GH(s) in the
right-half complex 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

Faculty In-charge Head of Department


Control System Lab [KEC-652]


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

% Plot Nyquist plot of given transfer function using MATLAB.

% Transfer Function = k/s(1+0.5s)(1+0.02s)

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(‘Gain Margin is’)

disp(Gm)

disp(‘Phase Margin is’)

disp(Pm)

disp(‘Phase crossover frequency is’)

ECE Department, Prepared By Checked By


SRMCEM, Lko Page 43 of 45

Faculty In-charge Head of Department


Control System Lab [KEC-652]

disp(Wcp)

disp(‘Gain crossover frequency is’)

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

ECE Department, Prepared By Checked By


SRMCEM, Lko Page 44 of 45

Faculty In-charge Head of Department


Control System Lab [KEC-652]

Phase crossover frequency is


10.0000

Gain crossover frequency is


4.2460

Nyquist Diagram

100

0 dB

80

60

40

20

Real Axis

Figure 10.2: Nyquist Plot

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.

ECE Department, Prepared By Checked By


SRMCEM, Lko Page 45 of 45

Faculty In-charge Head of Department

You might also like