Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Department: Lab Manual

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 36

DEPARTMENT

ELECTRONICS & COMMUNICATION ENGINEERING

LAB MANUAL

KEC652

CONTROL SYSTEM LAB-I


Department
Electronics and Communication Engineering
LAB MANUAL
CONTROL SYSTEM LAB-I
KEC652

Prepared by: Signature:


Dr. Alok Kumar Prof. P.K.Chopra
Asstt. Prof. Head of Deptt.

ECE deptt. ECE deptt.

AKGEC AKGEC
CO327.1 Students will understand about different tools in MATLAB along with the basic
matrix operations used in MATLAB.
CO327.2 Students will learn to plot the poles and zeros on s-plane and also able to determine
the transfer function of a given system.
CO327.3 Students will be able to determine the time domain response of a given system and
its various specifications
CO327.4 Students will be able to understand the concept of relative stability by determining
the stability in time domain using graphical method such as root locus.
CO327.5 Students will be able to determine the stability in frequency domain using Bode plot
method and also determine the relative stability parameters such as gain margin and
phase margin.
CO327.6 Students will be able to determine stability in frequency domain using Nyquist Plot
method and also determine gain margin and phase margin of the given system.
COURSE OUTCOMES

Course Outcomes and Corresponding Experiments

COs 327.1 327.2 327.3 327.4 327.5 327.6

Experiment No. 1 2,3 4,5 6,7 8,9,10 11,12

PO-CO Mapping

PO PO PO3 PO4 PO5 PO PO PO PO9 PO10 PO11 PO12


1 2 6 7 8
C210.1 3 2 2 1 2 1 1 0 2 1 3 2
C210.2 3 3 2 1 3 1 2 0 2 1 3 2
C210.3 3 2 3 1 3 2 3 0 2 1 3 2
C210.4 3 2 3 3 3 3 3 1 2 3 3 1
C210.5 3 2 2 1 2 2 2 1 2 1 3 1
C210.6 3 3 3 3 3 3 3 0 2 3 3 1

3- Strongly Related

2- Moderately Related

1- Slightly Related

0: Not Related

KEC652
CONTROL SYSTEM LAB-I
List of Experiments:

1. Different Toolboxes in MATLAB, Introduction to Control Systems Toolbox or its equivalent


open source freeware software like Scilabusing Spoken Tutorial MOOCs.

2. Determine transpose, inverse values of given matrix.

3. Plot the pole-zero configuration in s-plane for the given transfer function.

4. Determine the transfer function for given closed loop system in block diagram representation.

5. Plot unit step response of given transfer function and find delay time, rise time, peak time and
peak overshoot.

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

7. Plot root locus of given transfer function, locate closed loop poles for different values of k.
Also find out Wd and Wnat for a given root.

8. Create the state space model of a linear continuous system.

9. Determine the State Space representation of the given transfer function.

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

11. Determine the steady state errors of a given transfer function.

12. Plot Nyquist plot for given transfer function and to discuss closed loop stability. Also
determine the relative stability by measuring gain and phase margin.

Experiment-1
Objective:Different Toolboxes in MATLAB, Introduction to Control Systems Toolbox or its
equivalent open source freeware software like Scilabusing Spoken Tutorial MOOCs
Tool Used: Matlab 7.6
Theory:
INTRODUCTION:
MATLAB® is a high-performance language for technical computing. It integrates computation,
visualization, and programming in an easy-to-use environment where problems and solutions are
expressed in familiar mathematical notation. Typical uses include Math and computation
Algorithm development Data acquisition Modeling, simulation, and prototyping Data analysis,
exploration, and visualization Scientific and engineering graphics Application development,
including graphical user interface building MATLAB is an interactive system whose basic data
element is an array that does not require dimensioning. This allows you to solve many technical
computing problems, especially those with matrix and vector formulations, in a fraction of the
time it would take to write a program in a scalar noninteractive language such as C or Fortran.
The name MATLAB stands for matrix laboratory. MATLAB was originally written to provide
easy access to matrix software developed by the LINPACK and EISPACK projects. Today,
MATLAB engines incorporate the LAPACK and BLAS libraries, embedding the state of the art
in software for matrix computation. MATLAB has evolved over a period of years with input
from many users. In university environments, it is the standard instructional tool for introductory
and advanced courses in mathematics, engineering, and science. In industry, MATLAB is the
tool of choice for high-productivity research, development, and analysis. MATLAB features a
family of add-on application-specific solutions called toolboxes. Very important to most users of
MATLAB, toolboxes allow you to learn and apply specialized technology. Toolboxes are
comprehensive collections of MATLAB functions (M-files) that extend the MATLAB
environment to solve particular classes of problems. Areas in which toolboxes are available
include signal processing, control systems, neural networks, fuzzy logic, wavelets, simulation,
and many others.

MATLAB TOOLBOXES:

 Simulink
 Bioinformatics Toolbox
 Communications System Toolbox
 Computer Vision System Toolbox
 Control System Toolbox
 Curve Fitting Toolbox
 DSP System Toolbox
 Data Acquisition Toolbox
 Database Toolbox
 Datafeed Toolbox
 Econometrics Toolbox
 Embedded Coder
 Financial Instruments Toolbox
 Financial Toolbox
 Fixed-Point Toolbox
 Global Optimization Toolbox
 Image Acquisition Toolbox
 Image Processing Toolbox
 Instrument Control Toolbox
 MATLAB Builder NE
 MATLAB Coder
 MATLAB Compiler
 Model Predictive Control Toolbox
 Neural Network Toolbox
 Optimization Toolbox
 Parallel Computing Toolbox
 Partial Differential Equation Toolbox
 RF Toolbox

CONTROL SYSTEM TOOLBOX

Control System Toolbox™ provides industry-standard 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 visualize system behavior in time domain and
frequency domain. You can tune compensator parameters using automatic PID controller tuning,
Bode loop shaping, root locus method, LQR/LQG design, and other interactive and automated
techniques. You can validate your design by verifying rise time, overshoot, settling time, gain
and phase margins, and other requirements.

The Control System Toolbox™ product extends the MATLAB® software to provide functions
designed specifically for control engineering. This toolbox lets you construct and analyze linear
models of dynamic systems. Use Control System Toolbox functions to model dynamic systems
as transfer functions, in state-space form, or as arrays of frequency response data. Plot the time
and frequency responses of your system to understand how your system behaves. You can also
use the toolbox to design and tune single-loop or multiple-loop control systems using various
classical and state-space techniques
If you are new to Control System Toolbox, review the Control System Toolbox Getting Started
Guide to learn how to:
 Build and manipulate linear time-invariant models of dynamical systems
 Analyze such models and plot their time and frequency responses
 Design compensators using root locus and pole placement techniques
This guide also discusses model order reduction and linear quadratic Gaussian (LQG) control
design techniques with examples.

Results:
The study of MATLAB and its toolboxes has been done.

Experiment-2
Objective:Determine transpose, inverse values of given matrix.
Tool Used: Matlab 7.6
Theory:
Transpose: A matrix which is formed by turning all the rows of a given matrix into columns and
vice-versa. The transpose of matrix A is written AT.
Inverse: For a square matrix A, the inverse is written A-1. When A is multiplied by A-1 the result
is the identity matrix I. Non-square matrices do not have inverses.
Note: Not all square matrices have inverses. A square matrix which has an inverse is called
invertible or nonsingular, and a square matrix without an inverse is called noninvertible or
singular.
MATLAB code:
% Program for Transpose and inverse of a Given Matrix
clear all
clc
a=input('Enter the matrix'); % input matrix
b=a'; % transpose matrix
c=inv(a); % inverse matrix
disp(b)
disp(c)
Observation:Enter the matrix [12 3 4 ; 5 7 8; 6 9 15]

12 5 6 0 . 1009 −0 .0826 0 . 0092


Results:b= 3 7 9 c= −0 . 0275 0 . 4771 −0 . 2752
4 8 15 −0 . 0122 −0 .2324 0. 2110

Experiment-3
Objective: Plot the pole-zero configurations in s-plane for the given transfer function.
Tool Used: Matlab 7.6
Theory: In mathematics, signal processing and control theory, a pole–zero plot is a graphical
representation of a rationaltransfer function in the complex plane which helps to convey certain
properties of the system such as:
 Stability
 Causal system / anticausal system
 Region of convergence (ROC)
 Minimum phase / non minimum phase
A pole-zero plot shows the location in the complex plane of the poles and zeros of the transfer
function of a dynamic system, such as a controller, compensator, sensor, equalizer, filter, or
communications channel. By convention, the poles of the system are indicated in the plot by an
X while the zeroes are indicated by a circle or O.
A pole-zero plot can represent either a continuous-time (CT) or a discrete-time (DT) system. For
a CT system, the plane in which the poles and zeros appear is the s plane of the Laplace
transform. In this context, the parameter s represents the complexangular frequency, which is the
domain of the CT transfer function. For a DT system, the plane is the z plane, where z represents
the domain of the Z-transform.
MATLAB code:
% Program for pole zero configurations
% To obtain pole zero and gain of a given transfer function (s^2+2s+3)/(s^3+3s^2+4s+1)
clear all
clc
num=[0 1 2 3];
den=[1 3 4 1];
[z,p,k]= tf2zp(num,den)
pzmap(p,z)

Results:
z=
-1.0000 + 1.4142i
-1.0000 - 1.4142i
p=
-1.3412 + 1.1615i
-1.3412 - 1.1615i
-0.3177
k=
1

Pole-Zero Map
1.5

0.5
Imaginary Axis

-0.5

-1

-1.5
-1.4 -1.2 -1 -0.8 -0.6 -0.4 -0.2 0
Real Axis
Pole-Zero Map
1.5

0.5
Imaginary Axis

-0.5

-1

-1.5
-1.4 -1.2 -1 -0.8 -0.6 -0.4 -0.2 0
Real Axis

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

Tool Used: Matlab 7.6


Theory: A Closed-loop Control System, also known as a feedback control system is a
control system which uses the concept of an open loop system as its forward path but has one or
more feedback loops (hence its name) or paths between its output and its input. The reference to
“feedback”, simply means that some portion of the output is returned “back” to the input to form
part of the systems excitation.
Closed-loop systems are designed to automatically achieve and maintain the desired output
condition by comparing it with the actual condition. It does this by generating an error signal
which is the difference between the output and the reference input. In other words, a “closed-
loop system” is a fully automatic control system in which its control action being dependent on
the output in some way.
Figure1 Closed Loop System Representation

MATLAB code:
% To obtain closed loop transfer function of given block diagramrepresentation

%G(s)= 1/s and H(s)= (s+1)/(s+2) feedback is negative

clear all

clc

sys1=tf(1,[1 0])

sys2=tf([1 1],[1 2])

sys_f= feedback(sys1, sys2)

Results:

s+2
T.F =---------------------
s^2 + 3 s + 1
Experiment-5
Objective: Create the state space model of a linear continuous system.

Tool Used: MATLAB 7.6

Theory:
Creation of State-Space Models
The differential equations of a lumped linear network can be written in the form

x (t )  Ax (t )  B u (t ) (1)

y (t )  Cx (t )  D u (t )

This system of first-order differential equations is known as the state equation of the system and
x (t ) is the state vector and u (t ) is the input vector. The second equation is referred to as the
output equation. A is called the state matrix, B the input matrix, C the output matrix, and D the
direct transition matrix. One advantage of the state-space method is that the form lends itself
easily to the digital and/or analog computer methods of solution. Further, the state-space method
can be easily extended to analysis of nonlinear systems. State equations may be obtained from an
nth-order differential equation or directly from the system model by identifying appropriate state
variables.
To illustrate how we select a set of state variables, consider an nth-order linear plant model
described by the differential equation
dny d n 1 y dy
n
 an 1 n 1
   a1  a0 y  u (t )
dt dt dt (2)

where y (t ) is the plant output and u (t ) is the plant input. A state model for this system is not
unique but depends on the choice of a set of state variables. A useful set of state variables,
referred to as phase variables, is defined as

x1  y, x2  y , x3  y, , xn  y n1

Taking the derivatives, we have

x1  x2 , x 2  x3 , x 3  x4 ,  , and x n is given by (2). (3)

x n  a0 x1  a1 x2    an 1 xn  u (t )

or in matrix form

 x1   0 1 0  0   x1   0
 x   0 0 1  0   x2   0
 2    
                u (t )
       
 x n 1   0 0 0  1   xn 1   0
 x n   a0  a1  a2 an 1   xn  1 
(4)

and the output equation is

y   1 0 0  0 x
For Example, sys = ss(A,B,C,D) creates a state-space model object representing the continuous-
time state-space model
˙x=Ax+Buy=Cx+Du
For a model with Nx states, Ny outputs, and Nu inputs:
 A is an Nx-by-Nx real- or complex-valued matrix.
 B is an Nx-by-Nu real- or complex-valued matrix.
 C is an Ny-by-Nx real- or complex-valued matrix.
 D is an Ny-by-Nu real- or complex-valued matrix.
To set D = 0 , set D to the scalar 0 (zero), regardless of the dimension.
sys = ss(A,B,C,D,Ts) creates the discrete-time model
x[n+1]=Ax[n]+Bu[n]y[n]=Cx[n]+Du[n]
with sample time Ts (in seconds). Set Ts = -1 or Ts = [] to leave the sample time unspecified.
MATLAB Code:

% creation of state space model


clear all
clc
close all
% u=input vector of order mx1
% X= state vector of order nx1
% Y= output vector of order (px1)
A=[1 1; 1 2]; % A= system or state matrix (nxn)
B= [1 ; 1]; % B=input matrix (n x m )
C=[-1 1]; % C= output matrix (p x n)
D=[0]; % feed-forwaed matrix of (p x m)
system=ss(A,B,C,D);

Output:
system =

a=
x1 x2
x1 1 1
x2 1 2

b=
u1
x1 1
x2 1

c=
x1 x2
y1 -1 1

d=
u1
y1 0

Continuous-time state-space model.


Experiment-6

Objective: Determine the State Space representation of the given transfer functions.

Tool Used: Matlab 7.6


Theory:
Consider the transfer function of a third-order system
Y ( s) b s 2  b s  b0
 3 2 2 1
U ( s) s  a2 s  a1s  a0
(1)

where the numerator degree is lower than that of the denominator. The above transfer function is
decomposed into two blocks as shown in Figure 1.

U (s) 1 W ( s) Y (s)
3 2 b2 s 2  b1s  b0
s  a2 s  a1s  a0

Figure 1. Transfer function (7) arranged in cascade form

Denoting the output of the first block as W ( s) , we have

U (s)
W (s) 
s  a2 s 2  a1s  a0
3
and
Y ( s )  b2 s 2W ( s )  b1sW ( s)  b0W ( s )

or

s 3W (s )   a2 s 2W (s )  a1sW (s )  a0W ( s )  U ( s )

This results in the following time-domain equation

w   a2 w
   a1w  a0 w  u (t ) y (t )  b2 w
  b1w  b0 w
and

From the above expression we see that w has to go through three integrators to get w as
shown in Figure 2. Completing the above equations results in the phase-variable control
canonical simulation diagram.
b2
b1
+ +
u (t ) w 1 w
 1 w 1 w + y
x1 b0
- s x3 s x2 s
- -
a2
a1
a0

Figure 2. Phase variable control canonical simulation diagram.

The above simulation in block diagram form is suitable for SIMULINK diagram construction. You
may find it easier to construct the simulation diagram similar to the signal flow graph as shown
in Figure 6.

b2
b1
1
1 w 1
s w  1
s w s w b0 1 y
u (t ) x
 a2 3 x2 x1
 a1
 a0

Figure 3. Phase variable control canonical simulation diagram.

In order to write the state equation, the state variables x1 (t ) , x2 (t ) , and x3 (t ) are assigned to
the output of each integrator from the right to the left. Next an equation is written for the input
of each integrator. The results are

x1  x2

x 2  x3

x 3  a0 x1  a1 x2  a0 x1  u (t )

and the output equation is


y  b0 x1  b1 x2  b3 x3

or in matrix form

 x1   0 1 0   x1  0 
 x    0 0 1   x2   0  u (t )
 2 
 x 3    a0  a1  a2   x3  1 
(8)

 x1 
y   1 0 0  x2 
 x3 

It is important to note that the Mason’s gain formula can be applied to the simulation diagram
in Figure 6 to obtain the original transfer function. Indeed  of Mason’s gain formula is the
sI  A
characteristic equation. Also, the determinant of matrix in (8), results in the
characteristics equation. Keep in mind that there is not a unique state space representation for
a given transfer function.

The Control System Toolbox contains a set of functions for model conversion.

[A, B, C, D] = tf2ss(num, den) converts the system in transfer function from to state-space
phase variable control canonical form.

MATLAB:

% Obtain state space representation of given Transfer function

Clear all
clc
close all
num= [1 6 7 9];
den= [1 10 15 100];
[A, B , C , D] = tf2ss(num,den)

Output

A=
-10 -15 -100
1 0 0
0 1 0

B=

1
0
0

C=

-4 -8 -91

D=

Experiment-7

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

Tool Used: Matlab 7.6


Theory:
Response=natural response + forced response
Natural response: solution of equation of motion of the system when the excitation is zero. The
expression for natural response contains constants.
Forced response: any solution of equation of motion of the system for non zero excitation.
If the natural response tends to zero when time tends to infinity and the limit of the forced
response as time goes to infinity exists and is bounded (not infinite), then the limit is called
steady state response.
Transient response: Processof going from initial state to steady state.
Response to arbitrary excitation
First, assume that system is at rest at t=0. Idea: Use superposition principle. Split excitation to
sum of impulses. Find response to each impulse and sum up the responses.
t
x (t )=∫ F( τ )h(t−τ )dτ
0

Equivalent equation for response:


t
x (t )=∫ F(t−τ )h(τ )dτ
0

The above are called convolution integrals.

MATLAB Code:
Clear all
clc
closeall
% lsim(n,d,u,t)
%y=lsim(n,d,u,t)
num = [1 5];
den= [1 2 3 5];
t=0:0.15:10;
u=exp(-0.2*t);
y=lsim(num,den,u,t);
plot(t,y)
Experiment-8
Objective:Plot unit step response of given transfer function and find delay time,
rise time, peak time and peak overshoot.
Tool Used: Matlab 7.6
Theory
Time Response Specifications

Control systems are generally designed with damping less than one, i.e., oscillatory step
response. Higher order control systems usually have a pair of complex conjugate poles with
damping less than unity that dominate over the other poles. Therefore the time response of
second- and higher-order control systems to a step input is generally of damped oscillatory. In
specifying the transient-response characteristics of a control system to a unit step input, we
usually specify the following:

1. Delay time, td
2. Rise time, tr
3. Peak time, tp
4. Peak overshoot, Mp
5. Settling time, ts
6. Steady-state error, ess

1. Delay time, td: It is the time required for the response to reach 50% of the final value in first
attempt.

2. Rise time, tr: It is the time required for the response to rise from 0 to 100% of the final value
for the underdamped system.

3. Peak time (tP)- The time at which peak ovrshoot occurs is known as peak time.

tp 
wd
4. Peak Overshoot (Mp)- The maximum positive deviation of the output w.r.t to its desired
value is known as maximum overshoot.
Mp= c(t)max-1
PercentageMp = c(t)max-1/1 *100

1 2
%M P  e
5. Settling time, ts: It is the time required for the response to reach and stay within a specified
tolerance band ( 2% or 5%) of its final value.

MATLAB code:
%MATLAB Program generates the standard second-order system where wn = 5 rad/sec
% and zeta = 0.4.
clear all
clc
close all
wn=5;
zeta=0.4;
num=[wn^2];
den=[1 2*zeta*wn wn^2]
sys=tf(num,den)
t = 0:0.005:5;
step(num,den,t)
[y,x,t] = step(num,den,t)
[ymax,tp]= max(y);
peak_time = (tp - 1)*0.005
max_overshoot = ymax-1
percentageovershoot=max_overshoot*100
Results:peak_time = 0.6850
max_overshoot =0.2538 percentageovershoot = 25.3826

System: sys Step Response


Time1.4
(sec): 0.686
Amplitude: 1.25

1.2

0.8
Am plitude

0.6

0.4

0.2

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Time (sec)
System: sys Step Response
Time1.4
(sec): 0.686
Amplitude: 1.25

1.2

0.8
Amplitude

0.6

0.4

0.2

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Time (sec)

MATLAB code:
% Program for
%Example, the case where wn = 5 rad/sec and zeta = 0.4.

MATLAB Program generates the standard second-order system where wn = 5 rad/sec and zeta
= 0.4.

%MATLAB Program generates the standard second-order system where wn = 5 rad/sec and
zeta = 0.4.
clear all
clc
close all
wn=5;
zeta=0.4;
num=[wn^2];
den=[1 2*zeta*wn wn^2]
sys=tf(num,den)
t = 0:0.005:5;
step(num,den,t)
[y,x,t] = step(num,den,t)
r = 1;
while y(r) < 0.50001;
r = r + 1;
end;
dealy_time=(r-1)*0.005
while y(r) > 0.10001 & y(r)<0.90001;
r = r + 1;
end;
rise_time=(r-1)*0.005
s = 1001;
while y(s) > 0.98 & y(s) < 1.02;
s = s-1;
end
settling_time =(s - 1)*0.005
Results:
dealy_time = 0.2500
rise_time =0.3900settling_time =1.6800

Experiment-9

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

Tool Used: MATLAB 7.6

Theory:

steady state error: Steady-state error is defined as the difference between the input (command) and the
output of a system in the limit as time goes to infinity (i.e. when the response has reached steady state). The steady-
state error will depend on the type of input (step, ramp, etc.) as well as the system type (0, I, or II).

This is equivalent to the following system, where T(s) is the closed-loop transfer function.
We can calculate the steady-state error for this system from either the open- or closed-loop transfer function using
the Final Value Theorem. Recall that this theorem can only be applied if the subject of the limit (sE(s) in this
case) has poles with negative real part.

The Laplace transforms for some standard inputs and determine equations to calculate steady-state error from the
open-loop transfer function in each case.

 Step Input (R(s) = 1 / s):

 Ramp Input (R(s) = 1 / s^2):

 Parabolic Input (R(s) = 1 / s^3):

When we design a controller, we usually also want to compensate for disturbances to a system.
Let's say that we have a system with a disturbance that enters in the manner shown below.

MATLAB:

% Steady state error of a given transfer function


clearall
clc
closeall
% G(s) num is n1 and deno is d1
n1= [10 20];
d1 = [ 1 7 12 0 0];
% H(s) num is n2 and deno is d2
n2 = [1];
d2 = [1];
% to determine loop transfer function
[n3, d3] = series (n1, d1, n2, d2);
[z, p, k]= tf2zp(n3,d3);
k=0;
fori=1:length(p)
if (p(i)==0)
k=k+1;
end
end
K=n3(length(n3))/d3(length(d3) - k);
switch k
case 0
kp = K; kv = 0; ka=0;
step_ess=1/(1+kp);
ramp_ess = 1/kv;
parabolic_ess= 1/ka;
case 1
kp = inf; kv=K; ka=0;
step_ess=1/(1+kp);
ramp_ess = 1/kv;
parabolic_ess= 1/ka;
case 2
kp = inf; kv=inf; ka=K;
step_ess=1/(1+kp);
ramp_ess = 1/kv;
parabolic_ess= 1/ka;
otherwise
kp = inf; kv=inf; ka=inf;
step_ess=1/(1+kp);
ramp_ess = 1/kv;
parabolic_ess= 1/ka;
end
fprintf('The given system is TYPE %d system\n',k);
fprintf('The error constants of the system are \n');
fprintf('kp = %f \nkv = %f \nka= %f\n\n',kp, kv, ka);
fprintf(' The steady state error of the system for \n');
fprintf ('Unit step input = %f \nunit ramp input = %f \nunit parabolic- input = %f \n\n',step_ess,
ramp_ess, parabolic_ess);

OUTPUT

The given system is TYPE 2 system


>>fprintf('The error constants of the system are \n');
fprintf('kp = %f \nkv = %f \nka= %f\n\n',kp, kv, ka);
fprintf(' The steady state error of the system for \n');
The error constants of the system are
kp = Inf
kv = Inf
ka= 1.666667

The steady state error of the system for


>>fprintf ('Unit step input = %f \nunit ramp input = %f \nunit parabolic- input = ...
....%f \n\n',step_ess, ramp_ess, parabolic_ess);
fprintf ('Unit step input = %f \nunit ramp input = %f \nunit parabolic- input = ...
|
Error: String is not terminated properly.

>>fprintf(' The steady state error of the system for \n');


fprintf ('Unit step input = %f \nunit ramp input = %f \nunit parabolic- input = %f \n\n',step_ess,
ramp_ess, parabolic_ess);
The steady state error of the system for
Unit step input = 0.000000
unit ramp input = 0.000000
unit parabolic- input = 0.600000

Experiment-10
Objective:Plot root locus of given transfer function, locate closed loop poles for
different values of k. Also find out Wd and Wnat for a given root.

Tool Used: Matlab 7.6


Theory
Through the systematic formulation of set of rules of the root locus, we look for the clearest and
simplest explanation of the dynamic phenomena of the system. The rules of the root locus give
us a clear and precise understanding of the endless patterns that can be created by an infinite set
of characteristic equations. We could eventually learn to design without these rules, but our level
of skill would never be as high or our understanding as great. This is true of other analysis
techniques also such as Bode plots, Nyquist plots, Nichols charts, and so on, covered later in the
course.

The root-locus method has been established as a useful tool for the analysis and design oflinear
time-invariant control systems. The root-locus diagram is essentially a graphical plot ofthe loci
of the roots of the characteristic equation of a system as a function of a real parameter K which
varies from – ∞ to + ∞. It gives an indication of the absolute stability and, to someextent, the
relative stability of a control system with respect to the variation of the systemparameter K.
MATLAB code:
% Program for root locus
%For a unity feedback system with open-loop transfer function

clear all
clc
close all
s = tf('s');
G = (s^2-4*s+20)/((s+2)*(s+4));
rlocus(G);
axis equal;
zeta = 0.45;
wn = 0;
sgrid(zeta,wn);
title('Root locus for (s^2-4*s+20)/((s+2)*(s+4)');
[K,p]=rlocfind(G)

Observation:
Points on the root loci can be selected interactively (placing the cross-hair at the appropriate
place) using the [K,p] = rlocfind(GH) command. MATLAB then yields the gain K at that point
as well as all the poles p that have that gain. The root locus can be drawn over a grid generated
using the sgrid (zeta, wn) command, that allows constant damping ratio zeta and constant
natural frequency wncurves.
Select a point in the graphics window ( points are shown by ‘+’ mark)
selected_point = -1.7573 + 2.8215i
Results:
K = 0.3328
p = -1.7514 + 2.8159i
-1.7514 - 2.8159i
The system is found to be stable till the gain is less than equal to 1.51 after that the system
becomes unstable.
Root locus for (s 2-4*s+20)/((s+2)*(s+4)
5
0.45
4
System: G
3 Gain: 1.51
System: G
Pole: 0.0141 + 3.88i
Gain: 0.0248
2 Damping: -0.00363
Pole: -2.88 + 3.42e-008i
Overshoot (%): 101
Damping: 1
Frequency (rad/sec): 3.88
Im aginary Ax is

1 Overshoot (%): 0
Frequency (rad/sec): 2.88
0

-1 System: G
Gain: 1.14
-2 Pole: -0.334 - 3.78i
Damping: 0.0881
Overshoot (%): 75.7
-3
Frequency (rad/sec): 3.79

-4
0.45
-5
-6 -4 -2 0 2 4
Real Axis

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

Tool Used: Matlab 7.6


Theory
In electrical engineering and control theory, a Bode plot is a graph of the frequency response of a
system. It is usually a combination of a Bode magnitude plot, expressing the magnitude of the
frequency response, and a Bode phase plot, expressing the phase shift. Both quantities are plotted
against a horizontal axis proportional to the logarithm of frequency.

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.Bode plots were first introduced by
H.W. Bode, when he was working at Bell labs in the United States.

The gain margin is defined as the change in open loop gain required making the system unstable.
Systems with greater gain margins can withstand greater changes in system parameters before
becoming unstable in closed loop. Keep in mind that unity gain in magnitude is equal to a gain
of zero in dB.

The phase margin is defined as the change in open loop phase shift required making a closed
loop system unstable. The phase margin is the difference in phase between the phase curve and
-180 deg at the point corresponding to the frequency that gives us a gain of 0dB (the gain cross
over frequency, Wgc).

Likewise, the gain margin is the difference between the magnitude curve and 0dB at the point
corresponding to the frequency that gives us a phase of -180 deg (the phase cross over frequency,
Wpc).

MATLAB code:
% Program for Bode Plot
%Plot bode plot of given transfer function and find gain and phase margins.

% (s+2)/2S^3+3*s^2+4^s+1

clear all
clc
close all
num=[1 2]
den=[2 3 4 1]
sys=tf(num,den)
bode(sys)
margin(sys)
[Gm,Pm,Wg,Wp]=margin(sys)
% Gmdb=20*log10(Gm)

Bode Diagram
Gm = 20 dB (at 2.65 rad/sec) , Pm = 99 deg (at 0.671 rad/sec)
20

0
Magnitude (dB)

-20

-40

-60

-80

-100
0

-45
Phase (deg)

-90

-135

-180

-225
-2 -1 0 1 2
10 10 10 10 10
Frequency (rad/sec)

Results:Bode plot of the given transfer function is presented along with the parameters-

Gm = 10.0092
Pm = 98.9551
Wg = 2.6467
Wp= 0.6713
Gmdb =20.0080
Experiment-12
Objective: Plot Nyquist plot for given transfer function and to discuss closed loop
stability. Also determine the relative stability by measuring gain and phase margin.

Tool Used: Matlab 7.6


Theory:
A nyquist plot is used in automatic control and signal processing for assessing the stability of
asystem with feedback. It is represented by a graph in polar coordinates in which the gain
and phase of a frequency response are plotted. The plot of these phasor quantities shows the
phase as the angle and the magnitude as the distance from the origin. This plot combines the two
types of Bode plot — magnitude and phase — on a single graph with frequency as a parameter
along thecurve. Nyquist calculates the Nyquist frequency response of LTI models. When
invoked without left-hand arguments, nyquist produces a Nyquist plot on the screen. Nyquist
plots are used to analyze system properties including gain margin, phase margin, and stability.

The nyquist stability criterion provides a simple test for stability of a closed-loop control system
by examining the open-loop system’s Nyquist plot. Stability of the closed-loop control
systemmay be determined directly by computing the poles of the closed-loop transfer
function. Nyquist Criteria can tell us things about the frequency characteristics of the
system. For instance, some systems with constant gain might be stable for low-frequency inputs,
but become unstable for high-frequency inputs. Also, the Nyquist Criteria can tell us things about
the phase of the input signals, the time-shift of the system, and other important information

MATLAB code:
% Program for Nyquist Plot
%Plot nyquist plot of given transfer function and find gain and phase margins.

% (s-2)/4S^3+6*s^2+7^s+1

clear all
clc
close all
num=[1 -2]
den=[467 1]
sys=tf(num,den)
nyquist(sys)
[gm pm wcpwcg]=margin(h)
if(wcp>wcg)
disp(‘system is stable’)
else
disp(‘system is unstable’)
end

Nyquist Diagram
1.5

0.5
Im a g in a r y A x is

-0.5

-1

-1.5
-2.5 -2 -1.5 -1 -0.5 0 0.5
Real Axis

Observations:
No. of poles at right half of s-plane is P=1
So, No. of encirclements N= -P = -1, is the condition of stability
Result:
gm =0.5000
pm =-84.7724
wcp = 0
wcg = 0.2954
system is unstable
Nyquist plot for the given transfer function is presented. As, (-1, j0) point is encircled once in
clockwise direction, hence the given system is Unstable system.

You might also like