0% found this document useful (0 votes)
28 views43 pages

Control System

The document is a lab manual for the Control System Lab course at ABES Engineering College, detailing various experiments using MATLAB for B.Tech. 3rd Year ECE students. It includes aims, theories, MATLAB codes, results, precautions, and questions for each experiment related to control systems. The experiments cover topics such as matrix operations, transfer functions, state space models, and system responses.

Uploaded by

joshiabha040
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views43 pages

Control System

The document is a lab manual for the Control System Lab course at ABES Engineering College, detailing various experiments using MATLAB for B.Tech. 3rd Year ECE students. It includes aims, theories, MATLAB codes, results, precautions, and questions for each experiment related to control systems. The experiments cover topics such as matrix operations, transfer functions, state space models, and system responses.

Uploaded by

joshiabha040
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 43

ABES ENGINEERING COLLEGE GHAZIABAD

Department of Electronics & Communication Engineering

LAB MANUAL
CONTROL SYSTEM LAB [BEC-652]
B.Tech. 3rd Year 6th Semester

(Branch: ECE)

Lab In-Charge : Approved By:


Mr. Hitesh K. Tomar Dr.Rohit Sharma
HOD-ECE
S. No List of Experiments
Introduction to MATLAB Control System Toolbox.
1
Determine transpose, inverse values of given matrix.
2
Plot the pole-zero configuration in s-plane for the given transfer function.
3
Determine the transfer function for given closed loop system in block diagram
4 representation.

Create the state space model of a linear continuous system.


5
Determine the State Space representations of the given transfer function.
6
Determine the time response of the given system subjected to any arbitrary input.
7
Plot unit step response of given transfer function and find delay time, rise time, peak
8 time, peak overshoot and settling time.

Determine the steady state errors of a given transfer function.


9
Plot root locus of given transfer function, locate closed loop poles for different values of
10
K.
Plot bode plot of given transfer function. Also determine gain and phase margin.
11
Plot Nyquist plot for given transfer function. Also determine the relative stability by
12 measuring gain and phase margin.

Beyond the Syllabus

1. Design a Proportional Integral Derivative (PID) Controller in MATLAB.


2. Design a Lead-Lag Compensator in MATLAB.
EXPERIMENT NO. 1
AIM: Introduction to MATLAB Control System Toolbox.

SOFTWARE USED: MATLAB 7.0.4

THEORY:

General Introduction
• MATLAB is a powerful language for technical computing. The name MATLAB stands for
MATRIX laboratory, because its basic data element is a matrix (array).
• MATLAB can be used for math computations, modeling and simulations, data analysis
and processing, visualization and graphics, and algorithm development.
• MATLAB is widely used in universities and colleges in introductory and advanced
courses in mathematics, science, and especially in engineering. In industry the software is
used in research, development and design. The standard MATLAB program has tools
(functions) that can be used to solve common problems.
• In addition, MATLAB has optional toolboxes that are collections of specialized programs
designed to solve specific types of problems. Examples include toolboxes for signal processing,
symbolic calculations, and control systems.
• Until recently, most of the users of MATLAB have been people who had previous
knowledge of programming languages such as FORTRAN or C, and switched to
MATLAB as the software became popular. Consequently, the majority of the literature
that has been written about MATLAB assumes that the reader has knowledge of computer
programming.

Matlab Toolboxes:

 MATLAB
 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
 Real-Time Windows Target Robust Control Toolbox
 Signal Processing Toolbox
 SimBiology
 SimElectronics
 SimEvents
 SimHydraulics
 SimMechanics
 SimPowerSystems
 Simscape
 Simulink 3D Animation
 Simulink Coder
 Simulink Control Design
 Spreadsheet Link EX
 Stateflow Statistics Toolbox
 Symbolic Math Toolbox System
 Identification Toolbox
 Wavelet Toolbox
 xPC Target
 xPC Target Embedded Option

Control System Toolboxes:

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 can validate your
design by verifying rise time, overshoot, settling time, gain and phase margins, and other
requirements.

RESULT: Able to understand the different toolboxes of MATLAB & control System.
PRECAUTIONS:
1. Write all the syntax carefully

Questions based on this experiment:

Q.1 MATLAB stands for?

Ans:

Q.2 Write the applications of MATLAB?

Ans:

Q.3 Explain what is Simulink.

Ans:

Q.4 Explain how to modify the MATLAB path.

Ans:

Q.5 What is command window and workspace in MATLAB?

Ans:

Marks obtained

Name & Signature of Faculty


EXPERIMENT NO. 2

AIM: Determine transpose, inverse values of given matrix.

SOFTWARE USED: MATLAB 7.0.4

THEORY:

Transpose of a Matrix is formed by turning all the rows of the matrix into column & vice-versa. It is
written as AT.
For a Square Matrix A, the inverse matrix is written as A-1. When A is multiplied by A-1 the result is
I.
−1
A A =I

MATLAB CODE:

A = [1 2 1; 2 6 2; 3 5 8]
B = A’
C = inv(A)

RESULT: The transpose and inverse are obtained for the given matrix.

PRECAUTIONS:
1. Write all the syntax carefully.

Questions based on this experiment:

Q.1 State significance of Eigen values.

Ans:
Q.2 What is state space technique?

Ans:

Q.3 Where we find applications of state space technique?

Ans:

Q.4 Define controllability.

Ans:

Q.5 Define observability.

Ans:

Marks obtained

Name & Signature of Faculty


EXPERIMENT NO. 3

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

SOFTWARE USED: MATLAB 7.0.4

THEORY:

Transfer function is defined as the ratio of the Laplace transform of the output to the Laplace
transform of the input under the assumption that all initial conditions are zero. Zeros are determined
by equating the numerator of the transfer function to zero & Poles are determined by equating the
denominator of the transfer function to zero. At frequencies equal to the location of zeroes, the
magnitude of transfer function is zero. At frequencies equal to the location of poles, the magnitude
of the transfer function is infinite.

MATLAB CODE

num = input(‘enter the numerator of the transfer function’)


den = input(‘enter the denominator of the transfer function’)
h=tf(num,den)
pzmap(h)

RESULT: Pole zero plot of the given transfer function is obtained.

PRECAUTIONS:
1. Write all the syntax carefully.

Questions based on this experiment:

Q.1 Define impulse response.

Ans:

Q. 2 What are poles and zeros in transfer function?

Ans:
Q.3 What is relation between impulse response and step response?

Ans:

Q.4 What is BIBO stability?

Ans:

Q.5 How stability depends on location of z

Ans:

Marks obtained

Name & Signature of Faculty


EXPERIMENT NO. 4

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

SOFTWARE USED: MATLAB 7.0.4

THEORY:

Figure 1. Block diagram of closed loop system

MATLAB CODE:

G1 = input(‘enter the transfer function G1’)


G2 = input(‘enter the transfer function G2’)
H = input(‘enter the transfer function G2’)
x = feedback(‘G2,1’)
y = series(x,G1)
z = feedback(y,H)

RESULT: Transfer function of the given block diagram is obtained using MATLAB.

PRECAUTIONS:
1. Write all the syntax carefully.

Questions based on this experiment:


Q.1 Define transient state

Ans:

Q.2 Draw the unit step response of a damped system

Ans:
Q.3 What is dominant pole pair?

Ans:

Q.4 What will be the location of pole for an overdamped system?

Ans:

Q.5 What is settling time for first order system?

Ans:

Marks obtained

Name & Signature of Faculty


EXPERIMENT NO. 5
AIM: Create the state space model of a linear continuous system.

SOFTWARE USED: MATLAB 7.0.4


THEORY:

Most of the methods of describing a system are based on the transfer function approach. State Space
model is a commonly used technique which describe control systems which may have multiple
inputs & outputs and may not be LTI. For higher order systems, state space technique is preferred as
approaches based on transfer function become cumbersome to solve. The state space model takes
into account all the initial conditions and is not dependent on the type of input applied. It is
compatible with digital computer systems as it utilizes matrix algebra.
The standard state space model is written as:
˙ BU ( t )
Ẋ ( t )= AX (t)+
Y ( t )=CX ( t ) + D ¿ ¿
¿

Here, X(t) represents the state variable matrix of the order of (nx1), U(t) represents the input vector
matrix of the order of (mx1) & Y(t) is the output vector matrix (px1), where n is the number of state
variables, m is the number of inputs and p is the number of outputs. A is known as the sytem matrix
(order of nxn), B is the control matrix (of the order of nxm), C is the observation matrix (of the
order of pxn) and D is known as the direct transmission matrix (of the order of pxm).
The two equations above can also be used to draw the state diagram for any given system:

Figure
1. State diagram of MIMO system

For any given system, the number of state variables required is equal to either the number of energy
storage elements or the order of the differential equation describing the I/O relationship of the
system.
The state space model can be derived from the electrical circuit, differential equation or transfer
function. It serves two purposes:

(i) Transfer Function of the system.


(ii) Zero input response of the system.

MATLAB CODE:

A = input(‘enter the system matrix A’)


B = input(‘enter the control matrix B’)
C = input(‘enter the observation matrix C’)
D = input(‘enter the direct transmission matrix D’)
sys = ss(A, B, C, D)

RESULT: The state space model from matrices (A, B, C & D) has been obtained.

PRECAUTIONS:
1. Write all the syntax carefully.

Questions based on this experiment:


Q.1 Define state variable.

Ans:

Q.2 What are the advantages of state space model?

Ans:

Q.3 What is state vector matrix?

Ans:
Q.4 How is the number of required state variables is decided?

Ans:

Q.5 Define controllability and observability.

Ans:

Marks obtained

Name & Signature of Faculty


EXPERIMENT NO. 6
AIM: Determine the state space representations of the given transfer function.

SOFTWARE USED: MATLAB 7.0.4

THEORY:

The transfer function of any given system can be converted to the state space model by either
obtaining the differential equation from the transfer function or by applying this approach to the
numerator or denominator or the transfer function separately.
If the numerator and denominator of a transfer function have an expression in s, it is treated as a
series connection of the expression of numerator and denominator and state space model is
obtained.
Conversely, if the state space model is given, the transfer function can be obtained.

MATLAB CODE:

num = input(‘enter the numerator of the transfer function’)


den = input(‘enter the denominator of the transfer function’)
[A, B, C, D] = tf2ss(num, den)

RESULT: The user-defined transfer function has been converted to the state space representation.

PRECAUTIONS:
1. Write all the syntax carefully.

Questions based on this experiment:


Q.1 Define state transition matrix.

Ans:

Q.2 How can transfer function be determined from state space model?

Ans:
Q.3 What is state trajectory?

Ans:

Q.4 What is direct decomposition method of transfer function?

Ans:

Q.5 Describe Jordan matrix.

Ans;

Marks obtained

Name & Signature of Faculty

EXPERIMENT NO. 7
AIM: Determine the time response of the given system subjected to any arbitrary input.

SOFTWARE USED: MATLAB 7.0.4


THEORY:

The time response of any system refers to its output (expressed in time domain) for any signal
applied at the input. Generally, the time response is studied for standard test inputs like impulse,
step and ramp. For arbitrary inputs, MATLAB allows the time response to be studied.

MATLAB CODE:
num = input(‘enter the numerator of the transfer function’)
den = input(‘enter the denominator of the transfer function’)
sys = tf(num, den)
t = 0:0.04:8;
u = max(0,min(t-1,1));
lsim(sys, u, t)
grid on

RESULT: The time response for a user defined system subjected to an arbitrary input has been studied
and obtained.

PRECAUTIONS:
1. Write all the syntax carefully.

Questions based on this experiment:

Q.1 What is transient response?

Ans:

Q.2 What is steady state response?

Ans:

Q.3 What is the standard transfer function of a 1st order system?

Ans:
Q.4 What is the standard transfer function of a 2nd order system?

Ans:

Q.5 Define damping ratio.

Ans:

Marks obtained

Name & Signature of Faculty

EXPERIMENT NO. 8
AIM: Plot unit step response of given transfer function and find delay time, rise time, peak time,
peak overshoot and settling time.

SOFTWARE USED: MATLAB 7.0.4

THEORY:
The unit step response of a given system refers to its output expressed in time domain when the
applied input is a unit step signal. The expression for unit step response varies for the value of the
damping factor (ζ). For a typical 2nd order control system, the transfer function is:
2
Y (s) ωn
T . F .= = 2
R (s) s +2 ξ ω n s+ ω2n
1
Here, R ( s )= as the input is a unit step signal.
s
The step response is given as:
Y ( s )=R ( s )∗T . F .

( )
2
1 ωn
Y ( s )= . 2
s s +2 ξ ω n s+ ω2n
The inverse Laplace transform of the above equation is the unit step response of any given transfer
function. The time response has two components, transient and steady state response. A typical unit
step response is shown below.

Figure 1. Unit step response of a second order system

The step response overshoots the steady state value initially, and subsequently settles at the steady state value
which is equal to 1. There are different time response specifications which are considered as performance
indicators of the system. These are delay time, rise time, peak time, settling time and maximum peak
overshoot. These are now defined.
Delay Time (td): It is deifned as the time taken by the unit step repsonse to reach the 50% of steady
state value at the first instance. It is numerically computed as:

1+0.7 ξ
t d=
ωn

Rise Time(tr): It is the time take n by the unit step repsonse to reach the steady state value in the
first instance. It is calculated as:
−1
π−cos ξ
t r=
ω n √ ( 1−ξ2 )

Peak Time (tp): It the time required for the unit step response to reach the maximum peak (or
overshoot) of the time response. It is applicable for underdamped systems (i.e. ζ < 1). It is
calculated by the given equation:

π
t p=
ωn √ ( 1−ξ )
2

Settling Time (ts): It is defined as the time taken by the step reponse to settle with 2% or 5% of the
steady state value. It is estimated when the time response first reaches the margin of either 2% or
5% of the steady state value. Beyind settling time, the time response does not go out of the 2% or
5% of the steady state value. The equation for settling time is:

4
t s= (for 2% tolerance)
ξ ωn

3
t s= (for 5 % tolerance)
ξ ωn

Maximum Peak overshoot or Percent Overshoot (Mp): It the normalized difference between the
response peak value & steady value. This characteristic is not found in first order systems & is only
studied for higher order systems. It is calculated by subtracting the steady state value of time
repsonse from the peak magnitude of time repsonse (i.e. the magnitude at t = tp). It is written as:

M p=exp
( √( ) )
−ξπ
1−ξ 2

The value obtained by the above equaltion is multiplied by 100 to express the peak overshoot in
%age.
MATLAB CODE:
The following code plots the step response and also displays the values of all time response
specifications except delay time. The code below also provides additional information about the
value of undershoot for overdamped and critically damped systems.

num = input(‘enter the numerator of the transfer function’)


den = input(‘enter the denominator of the transfer function’)
sys = tf(num,den)
t = 0:0.05:10;
y = step(sys, t);
plot(t,y,’linewidth’,3)
grid on
title('Unit-Step Response of underdamped system')
xlabel('t')
ylable(' y(t)')
S = stepinfo(sys)

For delay time, use the code below:

num = input(‘enter the numerator of the transfer function’)


den = input(‘enter the denominator of the transfer function’)
sys = tf(num, den)
t = 0:0.02:20;
y = step(sys,t);
plot(t,y,’linewidth’,3)
grid on
title('Unit-Step Response of underdamped system')
xlabel('t')
ylabel(' y(t)')
rl = 1; while y (rl) < 0.1, rl = r l + 1; end;
r2 = 1; while y (r2) < 0.9, r2 = r2 + 1; end;
r3 = 1; while y (r3) < 0.5, r3 = r3 + 1; end;
rise time = (r2 - r1) * 0.02
delay time = (r3-1) *0.02

RESULT: Unit step response of second order system is plotted successfully and time response
specifications have been obtained. These are compared with the values obtained using the equations given in
the theory section and have been found to be in close agreement.
The system transfer function and the values of time response parameters are:

Transfer Function =
Table 1. Time response parameters

Parameter Value from equation Value from MATLAB

Peak Time

Rise Time

Settling Time

Maximum Peak Overshoot

Delay Time

PRECAUTIONS:
1. Write all the syntax carefully.

Questions based on this experiment:

Q.1 Define Settling time.

Ans:

Q.2 What is the time constant for a second order system?

Ans:

Q.3 What is a critically damped system?

Ans:

Q.4 Draw the unit impulse response of second order for underdamped system.

Ans:
Q.5 Define delay time.

Ans:

Marks obtained

Name & Signature of Faculty


EXPERIMENT NO. 9
AIM: Determine the steady state errors of a given transfer function.

SOFTWARE USED: MATLAB 7.0.4


THEORY:

Steady state error is a performance parameter for the time response of any given system. It si
defined as the difference in the measured value and the expected true value of the time response
when the system has achieved steady state.
For accuracy, steady state error is measured when transients have vanished and the system’s time
response is only due to the steady state value. The expression for steady state is given as:

e ss =lim
( sR(s)
)
s → 0 1+G ( s ) H (s)

Here, R(s) is the Laplace of input, G(s) in the forward path transfer function and H(s) is the transfer
function of the feedback path.

Features of Steady State Error


1. It is a measure of system accuracy. Highly accurate systems have limited and minimum
values of steady state error. Ideally, it should be zero but practically the design parameters
should focus on minimizing its value.
2. It depends on
a. The applied input (i.e. R(s))
b. Type of the system (i.e. no. of open loop poles at the origin)
3. As the type of the system increases, the value of steady state error reduces.
4. Steady state error is only calculated for stable closed loop systems.

MATLAB CODE:

s = tf('s');
G = ((s+3)*(s+5))/(s*(s+7)*(s+8));
T = feedback(G,1);
t = 0:0.1:25;
u = t;
[y,t,x] = lsim(T,u,t);
plot(t,y,'y',t,u,'m')
xlabel('Time (sec)')
ylabel('Amplitude')
title('Input-purple, Output-yellow')
RESULT: The steady state error for the given transfer function is calculated. It is in agreement with the
theoretical value calculated with the equation given above.

PRECAUTIONS:
1. Write all the syntax carefully.

Questions based on this experiment:


Q.1 Define steady state error.

Ans:

Q.2 What are the steady state error coefficients?

Ans:

Q.3 What is steady state error for a Type-2 system subjected to unit step input?

Ans:

Q.4 What is steady state error for a Type-0 system subjected to unit ramp input?

Ans:

Q.5 What are the dynamic error coefficients?

Ans:

Marks obtained

Name & Signature of Faculty

EXPERIMENT NO. 10
AIM: Plot locus of given transfer function, locate closed loop poles for different values of K.
.
SOFTWARE USED: MATLAB 7.0.4

THEORY:

The locus of the migration of the roots of the characteristic equation (i.e. the poles of the system)
when the gain of the system is varied from -∞ to +∞ is known as the Root Locus plot. It was
introduced by W.R. Evans. It follows the location of poles for system parameters and provides the
range of design parameters for which the poles crossover to the R.H.S. of the s-plane and hence
become unstable.
The system given below will oscillate between stability and instability as the value of K is varied.
The root locus plot will help in identifying the limit on the value of K such that the system remains
stable

Figure 1. Closed loop feedback system

There are several rules for plotting root locus on a graph sheet.
1. The number of branches in root locus is equal to the open loop poles.
2. The poles either terminate at zeroes or at infinity.
3. Only those points on the real axis which have odd number of poles and zeroes on the right,
lie on the root locus.
4. Poles which terminate at infinity do so asymptotically with angles given by
(2 q+1)
ϕ A= 180°
n−m
where, n is no. of poles, m is no. of zeroes and q is an integer which varies from 0 till
n-m-1.
5. The point at which the asymptotes intersect on the real axis is called the centroid and is
given by:
( ∑ of real part of poles ) −(∑ of real part of zeroes)
σ A=
( no . of poles )−(no . of zeroes)
6. The point on the real axis where the asymptotes leave is called the break-away point while
the point at which the asymptotes come back to the real axis is called the break-in point.
These are obtained by solving | |
dK
ds
=0.
7. For complex poles and zeroes, the angle of departure and arrival are calculated as:
°
∅ dep=180 −∅ and ∅ arr =180° +∅
where, φ is the net angle contribution to the departing pole and zero by other poles
and zeroes of the system. It is calculated as
∅ =∑ (∠ poles−∠ zeroes)
8. The value of K at which the root locus crosses the imaginary axis is obtained by applying
Routh-Hurwitz criteria to the given characteristic equation.
9. For any point to lie on the root locus it should satisfy the magnitude and angle criterion.
a. Magnitude Criterion: |G ( s ) H (s )|=1
b. Angle Criterion: ∠ G ( s ) H ( s ) =odd multiple of 180°

In MATLAB, the command rlocus(transfer function) will generate the root locus. For plotting in
MATLAB, different positive values of K should be tried to study the impact on location of poles.

MATLAB CODE:

num = input(‘enter the numerator of the transfer function’)


den = input(‘enter the denominator of the transfer function’)
sys=tf(num,den)
K = (0.1:0.05:5); %the range of K can be changed deepening on num & den
rlocus(sys, K);

RESULT: Root Locus is obtained for the entered transfer function. The effect of varying K is
also studied and understood.

PRECAUTIONS:
1. Write all the syntax carefully.

Questions based on this experiment:

Q.1 Define root locus

Ans:

Q.2 What is characteristic equation?

Ans:
Q.3 State angle and magnitude condition for root locus.

Ans:

Q.4 Explain the effect of addition of poles and zeroes on the root locus.

Ans:

Q.5 Define (i) centroid, (ii) break-away point, (iii) angle of arrival & depart

Ans:

Marks obtained

Name & Signature of Faculty


EXPERIMENT NO. 11

AIM: Plot Bode plot of given transfer function. Also determine gain and phase margins.

SOFTWARE USED: MATLAB 7.0.4

THEORY:

A Bode plot is a semilog plot of the transfer function magnitude and phase angle of the sinusoidal
transfer function as a function of frequency. The gain magnitude is calculated and plotted in
Decibels or dB. The magnitude in dB is calculated as 20 log 10|G( jω) H ( jω)|. The phase is
calculated by using standard complex number algebra.

Following are the components of a Bode plot along with their respective contributions to magnitude
and phase. A Bode plot is the summation of individual components which may be present in the
given system.

Component Effect on Magnitude Plot Effect on Phase Plot

Constant Gain, K Constant line at 20 log 10 K of 0 degrees


zero slope.

Pole at the origin Passes through the 0 dB point -90 degrees


at 1 rad/sec with a slope of -20
dB/decade.

Zero at the origin Passes through the 0 dB point +90 degrees


at 1 rad/sec with a slope of
+20 dB/decade.

Real poles Every nth order pole Every nth order pole
contributes a slope of –20n contributes a phase of -90n
dB/decade from the corner degrees from the corner
frequency. frequency

Real zeroes Every nth order zero Every nth order zero
contributes a slope of +20n contributes a phase of +90n
dB/decade from the corner degrees from the corner
frequency. frequency

Complex conjugate poles


Frequency Dependent
Complex conjugate zeroes
Bode plots are used to assess the stability of a system by calculating stability margins. These
include: gain crossover frequency, phase crossover frequency, gain margin and phase margin.

In MATLAB, bode(sys) plots the Bode response of an arbitrary LTI model sys. This model can be
continuous or discrete, and SISO or MIMO. bode(sys,w) explicitly specifies the frequency range or
frequency points to be used for the plot. Use logspace to generate logarithmically spaced frequency
vectors. All frequencies should be specified in radians/sec.

MATLAB CODE:

num=input('enter the numerator of the transfer function')


den=input('enter the denominator of the transfer function')
sys=tf(num,den)
[gm pm wpc wgc] = margin(sys)
bode(sys)

RESULT: Bode Plot is obtained for the entered transfer function and the stability margins have
also been obtained.

PRECAUTIONS:
1. Write all the syntax carefully.

Questions based on this experiment:

Q.1 Differentiate between time and frequency domain analysis.

Ans;

Q.2 Define gain crossover frequency.

Ans:
Q.3 Define phase crossover frequency.

Ans:

Q.4 Define gain margin and phase margin.

Ans:

Q.5 What are the stability conditions depending on Gain margin and phase margin?

Ans:

Marks obtained

Name & Signature of Faculty


EXPERIMENT NO. 12

AIM: Plot Nyquist plot for given transfer function. Also determine the relative stability by
measuring gain margin and phase margin.

SOFTWARE USED: MATLAB 7.0.4

THEORY:
Nyquist Plot
The Nyquist plot is a polar plot of the function D ( s )=1+G ( s ) H (s ) when s travels around the
contour given in Figure1. The contour in this figure covers the whole unstable half plane of the
complex plane s, R → ∞. Since the function D(s), according to Cauchy’s principle of argument,
must be analytic at every point on the contour, the poles of D(s) on the imaginary axis must be
encircled by infinitesimally small semicircles.

Figure 1. Nyquist contour


Nyquist Stability Criterion
It states that the number of unstable closed-loop poles is equal to the number of unstable open-loop
poles plus the number of encirclements of the origin of the Nyquist plot of the complex function
D(s). This can be easily justified by applying Cauchy’s principle of argument to the function D(s)
with the s-plane contour given in Figure 1. Note that Z and P represent the numbers of zeros and
poles, respectively, of D(s) in the unstable part of the complex plane. At the same time, the zeros of
D(s) are the closed-loop system poles, and the poles of D(s) are the open-loop system poles (closed-
loop zeros).The above criterion can be slightly simplified if instead of plotting the function
( s )=1+ G ( s ) H (s) , we plot only the function G ( s ) H (s) and count encirclement of the Nyquist plot
of G ( s ) H (s) around the point (-1, i0), so that the modified Nyquist criterion has the following form.
The number of unstable closed-loop poles (Z) is equal to the number of unstable open-loop poles
(P) plus the number of encirclements (N) of the point (-1, i0) of the Nyquist plot of G ( s ) H (s) , that
is Z=P+N

Phase and Gain Stability Margins


Two important notions can be derived from the Nyquist diagram: phase and gain stability margins.
The phase and gain stability margins are presented in Figure 2.
They give the degree of relative stability; in other words, they tell how far the given system is from
the instability region. Their formal definitions are given by
Pm=180 +arg ⁡{G ( j ωcg ) H ( j ωcg ) }
°

1
gm [ dB ] =20 log [dB]
|G ( jω cp ) H ( jω cp )|
Where ω cg∧ωcp stand for, respectively, the gain and phase crossover frequencies, which from Figure
2 are obtained as
|G( j ωcg ) H ( j ω cg )|=1 →ω cg
And
arg {G ( j ω cp ) H ( j ω cp ) }=180 →ω cp
°

Figure 2. Gain and Phase margin estimation using Nyquist plot

MATLAB CODE:

n1 = input('enter the numerator of the transfer function1')


d1=input('enter the denominator of the transfer function2')
h1=tf(n1,d1)
n2 = input('enter the numerator of the transfer function2')
d2=input('enter the denominator of the transfer function2')
h2=tf(n2,d2)
subplot(2,1,1)
nyquist(h1)
[gm1 pm1 wpc1 wgc1]=margin(h1)
subplot(2,1,2)
nyquist(h1)
[gm2 pm2 wpc2 wgc2]=margin(h2)

RESULT: Nyquist plot is obtained and the two systems are compared in terms of their relative
stability by calculating the gain and phase margins.

PRECAUTIONS:
1. Write all the syntax carefully.

Questions based on this experiment:

Q.1 Differentiate between polar plot and Nyquist plot.

Ans:

Q.2 Nyquist plot is obtained from open loop or closed loop?

Ans:

Q.3 What is Nyquist contour and the effect of poles at the origin?

Ans:

Q.4 State the Nyquist stability criterion.

Ans:

Q.5 What are the co-ordinates of the critical point in Nyquist contour?

Ans:
Marks obtained

Name & Signature of Faculty

Beyond the Syllabus


EXPERIMENT NO. 1

AIM: Design a PID Controller using MATLAB.

SOFTWARE USED: MATLAB 7.0.4

THEORY:

Feedback control is a control mechanism that uses information from measurements. A PID is
widely used in feedback control of industrial processes. A PID controller can be understood as a
controller that takes the present, the past, and the future of the error into consideration. A
proportional– integral–derivative controller (PID controller) is a method of the control loop
feedback. This method is composing of three controllers:
1. Proportional controller (PC)
The role of a proportional depends on the present error, accumulation of past error and on
prediction of future error. The weighted sum of these three actions is used to adjust Proportional
control in a simple and widely used method of control for many kinds of systems. In a
proportional controller, steady state error tends to depend inversely upon the proportional gain
(i.e. if the gain is made larger the error goes down). The proportional response can be adjusted
by multiplying the error by a constant K P, called the proportional gain. The proportional term is
given by:
P=K P . e ( t )

where, e(t) is the error signal.


A high proportional gain results in a large change in the output for a given change in the error. If
the proportional gain is very high, the system can become unstable. In contrast, a small gain
results in a small output response to a large input error. If the proportional gain is very low, the
control action may be too small when responding to system disturbances. Consequently, a
proportional controller (KP) will have the effect of reducing the rise time and will reduce, but
never eliminate, the steady-state error. In practice the proportional band (PB) is expressed as a
percentage so:
100
PB %=
Kp

2. Integral controller (IC)


An Integral controller (IC) is proportional to both the magnitude of the error and the duration of the
error. The integral in in a PID controller is the sum of the instantaneous error over time and gives
the accumulated offset that should have been corrected previously. Consequently, an integral
control (KI) will have the effect of eliminating the steady-state error, but it may make the transient
response worse. The integral term is given by:
t
I =K I ∫ e ( t ) . dt
0
3. Derivative controller (DC)

The derivative of the process error is calculated by determining the slope of the error over time and
multiplying this rate of change by the derivative gain K D. The derivative term slows the rate of
change of the controller output. A derivative control (K D) will have the effect of increasing the
stability of the system, reducing the overshoot, and improving the transient response. The derivative
term is given by:
d
D=K D e (t)
dt
The effect of each of controllers (KP, KI & KD) on a closed loop control system is summarized
below.

Table 1. Effect of controller parameters on a closed loop system

Peak
Parameter Rise Time Settling Time Steady State Error
Overshoot

KP Decrease Increase Minor Impact Decrease

Significantly
KD Decrease Increase Increase
Decreases

Minor Minor Minor


KI No change
Decrease Decrease Decrease

The transfer function of a PID controller is shown below:


2
KI K Ds +K Ps+K I
TF PID =K P + + K D s=
s s

MATLAB CODE:

Kp = 2;
Kd = 3;
KI = 0.5;
s=tf('s');
C = Kp + KI/s + Kd*s
G = s/(s^2+3*s+2)
sys1 = feedback(G,1) %unity feedback creation
step(sys1) %step response of non-PID controlled system
sys2 = series(C, G) %PID controller connected in series
sys3 = feedback(sys2, 1) %unity feedback created
step(sys3) %step response of a PID-controlled system

RESULT: A PID controller has been understood with its transfer function described in MATLAB.

PRECAUTIONS:
1. Write all the syntax carefully.

Questions based on this experiment:


Q. 1 Describe the importance of feedback in a control system.

Ans:

Q.2 What is a PID controller?

Ans:

Q.3 Describe KP, KI and KD.

Ans:

Q.4 Write the transfer function of a PID controller.

Ans:

Q.5 Describe the effect of inserting a PID controller in a closed loop control system.

Ans:
Marks obtained

Name & Signature of Faculty

EXPERIMENT NO. 2

AIM: Design a Lead-Lag Compensator using MATLAB.

SOFTWARE USED: MATLAB 7.0.4

THEORY:

Control Systems use compensation for techniques for:


1. In order to obtain the desired performance of the system, we use compensating networks.
Compensating networks are applied to the system in the form of feed forward path gain
adjustment.
2. Compensate a unstable system to make it stable.
4. A compensating network is used to minimize overshoot.
5. These compensating networks increase the steady state accuracy of the system. An
important point to be noted here is that the increase in the steady state accuracy brings
instability to the system.
6. Compensating networks also introduces poles and zeros in the system thereby causes
changes in the transfer function of the system. Due to this, performance specifications of the
system change.
A compensator can be of different types. Broadly, they can eb described as:
1. Lag Compensator
A lag compensator is an electrical network that is designed to compensate a control system
by adding a phase lag in the generated output signal when an input signal is applied to it.
Figure 1. Lag compensator
2. Lead Compensator
A phase lead compensator introduces a phase lead in the sinusoidal output of the system,
whenever a steady-state input is provided to it.

Figure 2. Lead compensator

3. Lead-Lag Compensator
A lag compensator improves the steady-state performance of the system but at the same
time, such a network causes a reduction in the overall bandwidth. A lead compensator offers
increased bandwidth, thus provides a fast response of the system, but this increases the
susceptibility of the system towards noise.
Lag-Lead compensator is an electrical network which produces phase lag at one frequency
region and phase lead at other frequency region. It is a combination of both the lag and the
lead compensators.
Figure 3. Lag-Lead compensator

MATLAB CODE:

K = 10;
Kc=3;
s=tf('s');
G = K/(s^3+7.2*s^2+7.2) %transfer function of uncompensated system
Gc = Kc*(s^2+1.4*s+0.13)/(s^2+3.2*s) %transfer function of lead-lag compensated system
%rlocus(G) %root locus of uncompensated system
rlocus(Gc) %root locus of lead-lag compensated system

RESULT: A lead-lag compensated system has been understood and simulated in MATLAB.

PRECAUTIONS:
1. Write all the syntax carefully.

Questions based on this experiment:


Q.1 Describe the use of compensation in control systems

Ans:
Q.2 What are dominant poles?

Ans:

Q.3 What is a Lead compensator? Mention its advantages and disadvantages.

Ans:

Q.4 What is a Lag compensator? Mention its advantages and disadvantages.

Ans:

Q.5 Describe the need and advantages of lead-lag compensators.

Ans:
Marks obtained

Name & Signature of Faculty

You might also like