Control System
Control System
LAB MANUAL
CONTROL SYSTEM LAB [BEC-652]
B.Tech. 3rd Year 6th Semester
(Branch: ECE)
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 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
Ans:
Ans:
Ans:
Ans:
Ans:
Marks obtained
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.
Ans:
Q.2 What is state space technique?
Ans:
Ans:
Ans:
Ans:
Marks obtained
AIM: Plot the pole-zero configuration in s-plane for the given transfer function.
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
PRECAUTIONS:
1. Write all the syntax carefully.
Ans:
Ans:
Q.3 What is relation between impulse response and step response?
Ans:
Ans:
Ans:
Marks obtained
AIM: Determine the transfer function for given closed loop system in block diagram
representation.
THEORY:
MATLAB CODE:
RESULT: Transfer function of the given block diagram is obtained using MATLAB.
PRECAUTIONS:
1. Write all the syntax carefully.
Ans:
Ans:
Q.3 What is dominant pole pair?
Ans:
Ans:
Ans:
Marks obtained
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:
MATLAB CODE:
RESULT: The state space model from matrices (A, B, C & D) has been obtained.
PRECAUTIONS:
1. Write all the syntax carefully.
Ans:
Ans:
Ans:
Q.4 How is the number of required state variables is decided?
Ans:
Ans:
Marks obtained
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:
RESULT: The user-defined transfer function has been converted to the state space representation.
PRECAUTIONS:
1. Write all the syntax carefully.
Ans:
Q.2 How can transfer function be determined from state space model?
Ans:
Q.3 What is state trajectory?
Ans:
Ans:
Ans;
Marks obtained
EXPERIMENT NO. 7
AIM: Determine the time response of the given system subjected to any arbitrary input.
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.
Ans:
Ans:
Ans:
Q.4 What is the standard transfer function of a 2nd order system?
Ans:
Ans:
Marks obtained
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.
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.
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.
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
Peak Time
Rise Time
Settling Time
Delay Time
PRECAUTIONS:
1. Write all the syntax carefully.
Ans:
Ans:
Ans:
Q.4 Draw the unit impulse response of second order for underdamped system.
Ans:
Q.5 Define delay time.
Ans:
Marks obtained
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.
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.
Ans:
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:
Ans:
Marks obtained
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
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:
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.
Ans:
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
AIM: Plot Bode plot of given transfer function. Also determine gain and phase margins.
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.
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
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:
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.
Ans;
Ans:
Q.3 Define phase crossover frequency.
Ans:
Ans:
Q.5 What are the stability conditions depending on Gain margin and phase margin?
Ans:
Marks obtained
AIM: Plot Nyquist plot for given transfer function. Also determine the relative stability by
measuring gain margin and phase margin.
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.
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
°
MATLAB CODE:
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.
Ans:
Ans:
Q.3 What is Nyquist contour and the effect of poles at the origin?
Ans:
Ans:
Q.5 What are the co-ordinates of the critical point in Nyquist contour?
Ans:
Marks obtained
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 )
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.
Peak
Parameter Rise Time Settling Time Steady State Error
Overshoot
Significantly
KD Decrease Increase Increase
Decreases
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.
Ans:
Ans:
Ans:
Ans:
Q.5 Describe the effect of inserting a PID controller in a closed loop control system.
Ans:
Marks obtained
EXPERIMENT NO. 2
THEORY:
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.
Ans:
Q.2 What are dominant poles?
Ans:
Ans:
Ans:
Ans:
Marks obtained