Control System Manual
Control System Manual
Laboratory Manual
Submitted by:-
Mughees Mehdi
70135670
BMET 5
Department of Technology
• Before starting a new lab, you must always read the laboratory manual for that
experiment and the instructor will discuss the experiment with you.
• Make sure that your observation for previous week experiment is evaluated by the
faculty member and your have transferred all the contents to your record before
entering to lab.
• At the beginning of the class, if the faculty or the instructor finds that a student is not
adequately prepared, they will be marked as absent and not be allowed to perform the
experiment.
• Please utilize teaching assistants fully. To encourage you to be prepared and to read the
lab manual before coming to the laboratory, unannounced questions may be asked at
Maintain silence, order and discipline inside the lab. Don’t use cell phones inside the laboratory.
Safety Precautions
This is a partial list of basic safety precautions to use when working on a computer:
1.1 Objective To introduce MATLAB and learn to represent and create polynomials
in MATLAB.
1.3 Theory
MATLAB is widely used in all areas of applied mathematics, in education and research at
universities, and in the industry. MATLAB stands for Matrix Laboratory and the software
is built up around vectors and matrices. MATLAB also has some tool boxes useful for
signal processing, image processing, optimization, etc.
Simulink is a tool for simulating dynamic systems. As an extension to MATLAB,
Simulink adds many features specific to dynamic systems while retaining all of
MATLAB's general purpose functionality. Progress of simulation can be viewed while
simulation is running. Final results can be made available in MATLAB workspace when
simulation is complete. Simulink is a graphical extension to MATLAB for modeling and
simulation of systems. One of the main advantages of Simulink is the ability to model a
nonlinear system, which a transfer function is unable to do. Another advantage of
Simulink is the ability to take on initial conditions.
1.5 Procedure
1. Invoke PC-MATLAB by clicking on the MATLAB icon
2. While in MATLAB, type "demo". This will bring up a menu of the available
demonstrations. Try some of the demonstrations for a quick display of MATLAB
capabilities.
3. You start Simulink from the MATLAB.
4. Open MATLAB and select the Simulink icon in the Toolbar (Fig. 1.1)
5. Or type “Simulink” in the Command window (Fig. 1.2)
6. Then the window appears Simulink Library Browser by writing
“slLibraryBrowser” in command window (Fig. 1.3).
1
Figure 1.1: How to Start Simulink from icon available in MATLAB Toolbar.
2
Figure 1.3: Simulink Library.
7. The Simulink Library Browser is the library where you find all the blocks
you may use in Simulink. Simulink software includes an extensive library of functions
commonly used in modeling a system.
8. Click the New icon on the Toolbar in order to create a new Simulink model Fig.
1.4
3
Figure 1.5: Model Surface for creating Simulink Model.
10. There are lots of parameters you may want to configure regarding your
simulation. Select
“Configuration Parameters…” in the Simulation menu shown in Fig. 1.6.
11. After that following window appear in Fig. 1.7.
12. Here you set important parameters such as:
i.Start and Stop time for the simulation
ii.What kind of Solver to be used (ode45, ode23 etc.)
iii.Fixed-step/Variable-step
4
Figure 1.7: Configuration window in Simulink.
5
Figure 1.9: Parameter setting for integrator.
.
Polynomial Overview
MATLAB provides functions for standard polynomial operations, such as polynomial roots,
evaluation, and differentiation. In addition, there are functions for more advanced
applications, such as curve fitting and partial fraction expansion.
6
Table 1.1: Polynomial Function Summary
Commands Explanation
Poly Used to get a vector of a polynomial represented
in factored form.
Conv Polynomials can be multiplied
Roots Used to find the roots of a polynomial.
Polyval Used to calculate the value of polynomial of
degree
pzmap Used to plot the pole zero map of the system.
Series Used to connect systems in series.
Parallel Used to connect systems in parallel.
Feedback Used to get the closed loop system.
Impulse Used to get impulse response of the system.
Step Used to get the step response of the system.
Plot Used for graphical representation.
Subplot Used to divides the current figure into an m -by-
n grid and creates axes in the position
Bode Used to get the frequency response of the
system.
Conj Used to get the conjugate of the system
Imag Used to get the imaginary part of the system
Real Used to get the real part of the system
Residue Used to convert a quotient of polynomial to pole
residue representation and back again.
tf Used to get transfer function expressed as
numerator polynomial divided by denominator
polynomial.
ss2tf Used to convert the state space to transfer
function.
tf2ss Used to convert transfer function to state space.
zpk Used to get a transfer function if the numerator
and denominator are expressed in factored form.
([ ]) Used to get transfer function.
Symbolic Math Toolbox contains additional specialized support for polynomial operations.
I.
II.
Lab Task 3:
Find the overall transfer function𝐶(𝑠) = 𝐺1(𝑠). 𝐺2(𝑠) that shown in Fig. 1.14.
8
𝑅 (𝑠)
1
( s + 8) (s + 2)
𝐵(𝑠) 2s3+5s2+3s+6
a) A(s) = s3+6s2+11s+6
b) 𝐵A((𝑠s)) = s2(s++21s)+33
Answers:
Open Loop System
An open-loop system is a type of control system in which the output is not fed back to the input
for comparison. The control action is independent of the output, and the system's behavior is
determined entirely by the input.
• Simplicity: Open-loop systems are simpler and easier to design, as they do not require feedback elements.
• Cost-Effective: These systems are less expensive to build since they don't need sensors or feedback
mechanisms.
• Stability: Open-loop systems are usually stable because there are no feedback loops that could introduce
instability.
9
• Limitations: The major limitation of open-loop systems is that they cannot correct for disturbances or
changes in the system parameters. Therefore, they may be inaccurate under varying operating conditions.
MATLAB is widely used in control system analysis and design. Here are some basic MATLAB
commands relevant to control systems:
These commands are useful for analyzing system stability, transient response, and performance
in control systems.
MATLAB CODE:
G = tf(num, den);
10
disp(G);
figure;
step(G);
figure;
bode(G);
figure;
pzmap(G);
In the presence of disturbances, the general form of a closed-loop system can be expressed as
follows:
Consider a feedback system where G(s)G(s)G(s) is the transfer function of the system,
H(s)H(s)H(s) is the feedback path, and D(s)D(s)D(s) is a disturbance.
11
Where:
This equation shows that the disturbance affects the output in addition to the reference input. The
system can reject some disturbances depending on the gain and feedback structure.
To compute the partial fraction of a transfer function in MATLAB, you can use the residue()
function. Here's how you can solve for the partial fraction decomposition of the given
expressions.
% Display results
disp('Residues:');
disp(R);
disp('Poles:');
disp(P);
disp('Direct term:');
disp(K);
% Display results
disp('Residues for B(s):');
disp(R_b);
disp('Poles for B(s):');
disp(P_b);
disp('Direct term for B(s):');
12
disp(K_b);
Explanation of Results:
• R represents the residues (the constants in the numerators of the partial fractions).
• P represents the poles (the roots of the denominator of the transfer function).
• K represents the direct term if there is any (in case of a non-proper transfer function).
Experiment No. 2
2.1 Objective
13
To develop mathematical models of Electrical and Mechanical systems in the design and
analysis of control systems with the help of MATLAB (Simulink).
2.3 Theory
2.3.1 Introduction
Mathematical modelling means describing a physical system using mathematical concepts
and language. It is the first step in studying the behavior of the system at hand. These
mathematical models help the designers in not only analyzing an existing system but also
designing new systems with more desirable behavior as per the specific needs of an
application. Unfortunately we can never make a completely precise model of a physical
system. There are always phenomena which we will not be able to model. Thus, there will
always be model errors or model uncertainties. But even if a model describes just a part of
the reality it can be very useful for analysis and design — if it describes the dominating
dynamic properties of the system.
There may be various representations of a mathematical model for a system each with their
own inherent advantages. After modelling a system we will learn two representations of
the developed model. Either representation gives us insight into the system from a different
perspective. Two of the most important types of mathematical modelling that we are going
to explore in this course are, Transfer Function and State Space Modelling. In this lab, we
will study only transfer function implementation of various physical systems. We will
study two types of systems which include Mechanical system and Electrical System. First
of all, we will derive the transfer function of these systems on paper, and after that we will
learn to implement these models on MATLAB and finally we will see how to analyze the
systems through their mathematical models on SIMULINK. For details, you can study
chapter two of Control systems by Norman. S. Nise.
2.3.3 Modelling an Electrical System Now let’s take an example of commonly used
electrical circuit and try to develop its mathematical model. Given below in Fig. 2.1 is a
series RLC circuit. By applying Kirchhoff’s voltage law in the single loop, we obtain
𝑑𝑖 1 (2.1)
14
𝐿 + 𝑅𝑖 + ∫ 𝑖 𝑑𝑡 = 𝑒𝑖
𝑑𝑡 𝐶
If we are interested in observing the capacitor voltage then our output will be Taking
Laplace transform of (2.1) and (2.2) will yield,
1 (2.3)
𝐿𝑠𝐼(𝑠) + 𝑅𝐼(𝑠) + 𝐼(𝑠) = 𝐸𝑖(𝑠)
𝐶𝑠
1 (2.4)
𝐶𝑠 𝐼(𝑠) = 𝐸𝑜(𝑠)
Now substituting (2.4) in (2.3), we will get the transfer function of this RLC Circuit
𝐸𝑜(𝑠) 1 (2.5)
= 2+ 𝑅𝐶𝑠 + 1
𝐸𝑖 (𝑠) 𝐿𝐶𝑠
15
Figure: 2.2 mass-spring system.
Let we apply a force 𝐹𝑎(𝑡) on the mass 𝑀 and displace it from its mean position, say 𝑥0, to a
new position, say 𝑥1. At this point there will be other forces acting on the mass 𝑀 besides our
applied force.
One of these three forces is Friction Force, 𝐹𝑓(𝑡). For the simplicity we assume here that the
wall friction 𝑏 is a viscous damper, that is, the friction force is linearly proportional to the
velocity of the mass. In reality, however, this friction force may behave as a coulomb
damper, also known as dry friction, which is a nonlinear function of the mass velocity. For a
well-lubricated, sliding surface, the viscous friction is an appropriate approximation. Hence
for friction force, 𝐹𝑓(𝑡)., we can write that
This friction force will obviously be in the reverse direction of applied force.
Another force acting on the mass is the spring force which is also in the opposite direction to
the applied force. According to Hook’s Law the extension of a spring is directly proportional
to the applied load as long as the load does not exceed spring’s elastic limits. Mathematically
Hook’s law can be stated as
𝐹𝑠(𝑡) = 𝑘𝑥(𝑡) (2.7)
Here 𝐹𝑠(𝑡) is spring force, k is the spring constant and x is the displacement as a result of
applied force.
∑ 𝐹 = 𝑀𝒂 (2.8)
16
from Fig. 2.2(b) we note that there are a total of three forces acting on the mass M. So,
∑ 𝐹 = 𝐹𝑎 − 𝐹𝑓 − 𝐹𝑠 (2.9)
Putting (2.6) and (2.7) in (2.9) and then putting the resulting equation in (2.8) and
rearranging the term, we get
𝑑2𝑥(𝑡) 𝑑𝑥(𝑡) (2.10)
𝑀 𝑑𝑡2 + 𝑏 𝑑𝑡 + 𝑘𝑥(𝑡) = 𝐹𝑎(𝑡)
𝑋(𝑠) 1 (2.13)
𝐹 = 2+ 𝑏𝑠 + 𝑘
𝑎(𝑠) 𝑀𝑠
2.4 Pre-Lab
• Hands on experience is required on Simulink
• Student should know how to model any dynamic systems (Section 2.3.2)
2.5 Procedure
• Open MATLAB m.file
• Write code of open loop transfer function
• Open Simulink in MATLAB and create a new model
17
Lab Task
a) Electrical Networks
Implement the transfer function of circuits given below Fig. 2.3 & Fig. 2.4 using
Simulink and analyze its
1. Step response
b) Mechanical Network
Find the transfer function 𝐺(𝑠) = 2(𝑠)/𝑇(𝑠) for the rotational mechanical system
that are shown in Fig. 2.5 and Implement the transfer function of circuit given below
using SIMULINK and analyze its
1. Step response
18
2.6 Observation and Results
You are required to provide the following in your lab report
Lab objectives
MATLAB codes
Results (graphs/tables) duly commented and discussed
Conclusion
Answers:
19
The voltage V′ across the capacitor C1 is given by the impedance relation:
Z1=1sC1.Z_1 = \frac{1}{sC_1}.Z1=sC11.
Substituting Z1:
V′=1sC11sC1+R1Vin=1sC11+sC1R1sC1Vin=11+sC1R1Vin.V' =
\frac{\frac{1}{sC_1}}{\frac{1}{sC_1} + R_1} V_{\text{in}} = \frac{\frac{1}{sC_1}}{\frac{1
+ sC_1 R_1}{sC_1}} V_{\text{in}} = \frac{1}{1 + sC_1 R_1} V_{\text{in}}.V′=sC11+R1sC1
1Vin=sC11+sC1R1sC11Vin=1+sC1R11Vin.
The feedback network consists of R2and C2. The feedback voltage VoutV_{\text{out}}Vout is
derived through the impedance combination of R2R_2R2 and C2C_2C2.
VoutV′=−ZfR1.\frac{V_{\text{out}}}{V'} = -\frac{Z_f}{R_1}.V′Vout=−R1Zf.
Substituting Zf,:
VoutV′=−R21+sR2C2R1=−R2R1(1+sR2C2).\frac{V_{\text{out}}}{V'} = -\frac{\frac{R_2}{1
+ sR_2C_2}}{R_1} = -\frac{R_2}{R_1(1 + sR_2C_2)}.V′Vout=−R11+sR2C2R2=−R1(1+sR2
C2)R2.
The overall transfer function is the product of the input transfer function and the feedback
transfer function:
VoutVin=11+sC1R1⋅−R2R1(1+sR2C2).\frac{V_{\text{out}}}{V_{\text{in}}} = \frac{1}{1 +
sC_1 R_1} \cdot -\frac{R_2}{R_1(1 + sR_2C_2)}.VinVout=1+sC1R11⋅−R1(1+sR2C2)R2.
Simplify:
VoutVin=−R2R1⋅1(1+sC1R1)(1+sR2C2).\frac{V_{\text{out}}}{V_{\text{in}}} = -
\frac{R_2}{R_1} \cdot \frac{1}{(1 + sC_1 R_1)(1 + sR_2C_2)}.VinVout=−R1R2⋅(1+sC1R1
)(1+sR2C2)1.
20
Ans 3: Simulink Implementation
21
Experiment No. 3
To Measure Time-Domain Performance of the System
3.1 Objective
To Measure performance of the system through time domain performance parameters
using
MATLAB.
3.3 Theory
The output response of a system is the sum of two responses: the forced response and the
natural response. Although many techniques, such as solving a differential equation or
taking the inverse Laplace transform, enable us to evaluate this output response, these
techniques are laborious and time-consuming. Productivity is aided by analysis and
design techniques that yield results in a minimum of time. If the technique is so rapid that
we feel we derive the desired result by inspection, we sometimes use the attribute
qualitative to describe the method. The use of poles and zeros and their relationship to
the time response of a system is such a technique. Learning this relationship gives us a
qualitative "handle" on problems. The concept of poles and zeros, fundamental to the
analysis and design of control systems, simplifies the evaluation of a system's response.
22
Figure: 3.1 Performance parameters of a step response.
The performance parameters depicted in the Fig. 3.1 above can be described as follows.
a) Rise Time
Rise time is the time taken by a signal to change from a specified low value to a
specified high value.
b) Peak Time
The peak time is the time required for the response to reach the highest peak of the
overshoot. Peak time is inversely proportional to the amount of overshoot.
c) Settling time The time required for the system’s output to settle within a
percentage of the input amplitude (which is usually taken as 2%) is called settling time.
Settling time T𝑠, is calculated as
4
Ts =
ζωo
d) Overshoot
Overshoot is the maximum peak value of the response curve measured from the
desired response of the system. It is calculated as
Mp − fv
P.O = × 100%
fv
Where 𝑀𝑝 is the highest peak magnitude of output and 𝑓𝑣 is the final value of the
It is the difference between the desired final output and the actual one. Practically
this difference can never be reduced to zero. It is calculated as 𝑎𝑏𝑠(𝑑𝑐𝑔𝑎𝑖𝑛(1 − 𝑠𝑦𝑠𝑡𝑒𝑚))
3.4 Pre-Lab
• Hands on experience is required on Simulink
• Student should know how to calculate the performance parameters of first and
second order systems (Section 3.3)
23
3.5 Procedure • Open Simulink in MATLAB and create a new model • Given the transfer
function 𝐺(𝑠) = 𝑎/(𝑠 + 𝑎), evaluate settling time and rise time for the following values of
a: 1, 2, 3, 4. Also, plot the poles.
• Given the transfer function 𝐺(𝑠) = 𝑏/(𝑠2 + 𝑎𝑠 + 𝑏), evaluate percent overshoot,
settling time, peak time, and rise time for the following values: a = 4; b = 25. Also,
plot the poles.
• Add a pole at -200 to the above system and find whether the transient response
calculated before will be appreciably affected or not.
• Repeat the above step by adding poles at -20, -10 and -2.
• A zero is added to the above system at -50 and then moved to -20, -10, -5, and
-2. List the values of zero location in the order of the greatest to the least effect upon
the pure second-order transient response.
• Plot the step response of the above systems and compare their performance.
• Make your plots on a single graph, using the Simulink LTI Viewer. Record
percent overshoot, settling time, peak time, and rise time for each response.
24
𝟐
+
R(s )
E(s)
𝑮(𝒔) = 𝒔(𝒔+𝟐𝛇𝒏𝛚 Y(s)
𝐧)
Experiment No. 4
Reduction of Multiple Sub-Systems
4.1 Objective
To learn commands in MATLAB that would be used to reduce linear systems block
diagram using series, parallel and feedback configuration.
4.2 Equipment
PC and MATLAB® R2017b
4.3 Theory
Multiple subsystems are represented in two ways: as block diagrams and as signal-flow
graphs. Although neither representation is limited to a particular analysis and design
technique, block diagrams are usually used for frequency-domain analysis and design,
and signal-flow graphs for state-space analysis.
a. Series configuration:
If the two blocks are connected as shown in Fig. 4.1 then the blocks are said to be in
series. It would like multiplying two transfer functions. The MATLAB command for
such configuration is “series”.
25
Figure: 4.1 Series configuration.
26
Figure: 4.5 Unity feedback system.
The MATLAB command for implementing a feedback system is “feedback” as shown in Fig. 4.6
When H(s) is non-unity or specified, such a system is said to be a non-unity feedback system
as shown in Fig. 4.7
Poles and Zeros of System: To obtain the poles and zeros of the system use the MATLAB
command “pole” and “zero” respectively as shown in example 5. You can also use MATLAB
27
command “pzmap” to obtain the same.
4.4 Pre-Lab
1. Hands on experience on Simulink and MATLAB Programming
2. Students must have knowledge of basic configurations of systems and their
MATLAB commands (Section 4.3)
4.5 Procedure
1. First of all open the MATLAB i.e. m.file.
2. Then write the code for a block reduction using via series, parallel and feedback
commands. As shown below:
Example 1: Given the transfer functions that are shown in Fig. 4.9 of individual blocks
generate the system transfer function of the block combinations.
28
The result is as shown in Fig. 4.12
Example 4: Given a non-unity feedback system as shown in the Fig. 4.13, obtain the
overall transfer function using MATLAB:
Answer:
30
We aim to derive the equivalent transfer function:
T(s)=C(s)R(s)T(s) = \frac{C(s)}{R(s)}T(s)=R(s)C(s)
Step-by-Step Solution:
Here:
• G(s)=1G(s) = 1G(s)=1
• H(s)=H1(s)+H2(s)=1s+sH(s) = H_1(s) + H_2(s) = \frac{1}{s} + sH(s)=H1(s)+H2(s)=s1+s
Combine terms:
31
Simplify:
Final Answer:
T(s)=ss+1T(s) = \frac{s}{s + 1}T(s)=s+1s
Experiment No. 5
Stability of a System
5.1 Objective
To evaluate the stability of Linear Time Invariant System (LTI).
5.2 Equipment
PC and MATLAB® R2017b
5.3 Theory
5.4 Pre-Lab
1. Chapter No 6 (Norman S Nise)
2. Hands on experience on Simulink and MATLAB Programming
5.5 Procedure
• First of all open MATLAB i.e m.file
• Open Simulink in MATLAB and create a new model
• Open Simulink Library Browser where you find all the blocks you may use
in Simulink
Lab Task
• Find the equivalent transfer function of the negative feedback system is shown
in • Fig. 5.2: If 𝐺(𝑠) =K 2/s(s+2) and H(s) = 1.
R(s) +
C(s)
G(s)
_
H(s)
33
• For the system find two values of gain that will yield closed-loop, over-damped,
secondorder poles. Repeat for under damped poles.
• For the system find the value of gain, K that will make the system critically
damped.
• For the system find the value of gain, K that will make the system marginally
stable.
• Find the range of gain, K, for the system of Fig. 5.3 that will cause the system
to be stable, unstable, and marginally stable. Assume K > 0.
+ E(s) 𝑲
R(s ) C (s)
𝒔(𝒔 + 𝟕)(𝒔 + 𝟏𝟏)
_
+ 𝑲
R(s ) C (s)
𝒔(𝒔 + 𝟕)(𝒔 + 𝟏𝟏)
_
the given feedback control system and determine the range of K for stable operation, as well as
the values of K that yield different damping characteristics.
System Analysis
The given feedback control system has the following transfer function:
G(s) = K / (s(s+7)(s+11))
Stability Analysis
To determine the range of K for stable operation, we'll use the Routh-Hurwitz criterion. The
characteristic equation of the system is:
1 + G(s)H(s) = 0
s^3 | 1 77
s^2 | 18 K
s^1 | (18*77 - K) / 18
s^0 | K
For stability, all elements in the first column of the Routh array must be positive. Therefore, we
have the following conditions:
To determine the values of K that yield different damping characteristics, let's analyze the
characteristic equation:
35
We can relate the coefficients of this equation to the standard form of a cubic polynomial:
where:
2ζωn = 18
ωn^2 = 77
ωn = √77 ≈ 8.77
ζ = 18 / (2*√77) ≈ 1.02
Since ζ > 1, the system is overdamped for all values of K within the stable range.
Step Response
To plot the step response for different values of K, we can use a simulation tool like MATLAB
or Python with libraries like SciPy or Control Systems Toolbox.
Matlab
% Define the transfer function
num = K;
den = [1 18 77 K];
sys = tf(num, den);
This code will generate a plot showing the step response for different values of K. You can
observe how the overshoot and settling time change as K varies within the stable range.
36
In Summary:
Experiment No. 6
6.1 Objective
To study and verify the steady state errors of Linear Time Invariant Systems using
Simulink.
6.2 Equipment
PC and MATLAB® R2017b
6.3 Theory
Steady State Error is the difference between input and output at t=∞ or at large value
of time, when our system waveform reaches steady state. It is represented by e
(∞).For finding steady state error of a particular system, three inputs are used i.e.
1. Step input
2. Ramp input
3. Parabola input
Steady state error can be calculated of only Stable systems. Unstable system’s steady
state error does not exist as there is no steady state in systems.
Steady state error can be improved by multiplying the system with integration (1/𝑠^𝑛 )
where n=1, 2, 3…
6.4 Pre-Lab
37
1. Student must be familiar with the features of MATLAB i.e. SIMULINK.
2. Student must read the chapter no 7 of the text book ‘Norman S Nice’.
6.5 Procedure
• Open Simulink in MATLAB and create a new model
• Open Simulink Library Browser where you find all the blocks you may use
in Simulink
• To verify the effect of input waveform and system type upon steady-state error.
Lab Task
1. For the negative feedback system that is shown in Fig. 6.1
R(s) + C(s)
G(s)
H(s)
Where G(s) = K(s+6)/(s+4)(s+7)( s+9)(s+12) and H(s) = 1, calculate the steady-state error
Repeat lab task 1 for G(s) = K (s+6)(s+8) / s(s+4)(s+7)( s+9)(s+12) and H(s)
= 1.
Lab Task
1. Using Simulink set up the negative feedback system of task 1. Plot on one
graph the error signal of the system for an input of 5u(t) and K = 50, 500, 1000
and 5000. Repeat for inputs of 5tu(t) and 5t2u(t).
2. Using Simulink set up the negative feedback system of task 2. Plot on one
graph the error signal of the system for an input of 5u(t) and K = 50, 500, 1000
and 5000. Repeat for inputs of 5tu(t) and 5t2u(t).
3. Using Simulink set up the negative feedback system of task 3. Plot on one
graph the error signal of the system for an input of 5u(t) and K = 200, 400, 800and
1000. Repeat for inputs of 5tu(t) and 5t2u(t).
38
MATLAB code for the lab tasks performed
Screenshots of the Simulink Models
Verification of results
Answer:
40
Experiment No. 7
Root Locus
7.1 Objective
To know, how the root locus (path of roots) produce when value of gain (k) changes.
7.2 Equipment
PC and MATLAB® R2017b
7.3 Theory
In control theory and stability theory, root locus analysis is a graphical method for
examining how the roots of a system change with variation of a certain system parameter,
commonly gain within a feedback system. The root locus plots the poles of the closed
loop transfer function in the complex s plane as a function of a gain parameter. The path
that closed loop poles attain when the value of k changes is called Root Locus. The path
of root locus can be of any shape. It starts with the open loop pole and ends at the open
loop zero.
Root locus effects on stability, steady state error. Here k changes from 0 to ∞.At k=o the
position of poles of open loop system and closed loop system is same but by increasing
k, the position of closed loop pole will change only.
In the previous sessions, we discussed absolute stability of a closed-loop feedback
control system using Routh-Hurwitz method. We also studied how the performance of a
feedback system can be described in terms of the location of the roots of the
characteristic equation in the s-plane. We know that the response of a closed-loop
feedback control system can be adjusted to achieve the desired performance by judicious
selection of one or more system parameters. It is, therefore, very useful to determine how
the roots of the characteristic equation move around the s-plane as we change one
parameter. The Root Locus method, as the name suggests, looks at the loci of the roots as
some parameter of interest, within the system, is varied. Since we already know that the
position of the roots of the characteristic equation strongly influence the step response of
the system, we can find values of the parameter which will position the roots
appropriately, using the method of Root Locus. This method involves root locus diagrams
which the students are expected to have learnt in the theory class. In this lab we will use
MATLAB’s powerful computing capability to find and trace root locus of a given system.
7.4 Pre-Lab
1. Student must be familiar with the features of MATLAB i.e. SIMULINK.
2. Student must read the chapter no 8 of the text book ‘Norman S Nice’.
7.5 Procedure
1. First of all open the MATLAB i.e. m.file.
2. Then write the code of open loop transfer function.
3. Then use a command rlocus (open loop T.F.).
41
4. This command will show the path of roots.
5. Then by the analysis of graph showed, we can see various things like %OS,
gain (k) etc at any point of graph.
Example
Let we have a unity feedback system as shown in Fig. 7.1. In plotting root loci with
MATLAB we need the characteristic equation of this system defined as.
(s + 3 )
1+K =0
s(s + 1)(s2 + 4s + 16)
MATLAB provides us with 𝑟𝑙𝑜𝑐𝑢𝑠 command to compute and display root locus of any
system. The syntax of this command is as follows
>>𝑟𝑙𝑜𝑐𝑢𝑠(𝑛𝑢𝑚,𝑑𝑒𝑛)
Here 𝑛𝑢𝑚 is array of open-loop numerator coefficients and den is array of open-loop
denominator coefficients. Using this command, the root locus is plotted on the Figure
window as shown in Fig. 7.2. The gain vector K is automatically determined and contains
all the gain values for which the closed-loop poles are to be computed. However, we can
define vector K as per our own will and provide it to 𝑟𝑙𝑜𝑐𝑢𝑠 command as
>>𝑟𝑙𝑜𝑐𝑢𝑠 (𝑛𝑢𝑚,𝑑𝑒𝑛,𝐾)
42
Figure: 7.2 Root Locus of the system shown in Figure: 7.1.
Lab Task
1. Find the loop gain and poles position by plotting the root locus of the following system
that is shown in Fig. 7.3 with negative feedback.
K(s+1.5)
2. If the open-loop system is G(s) = , estimate the percent overshoot at the
s(s+0.5)(s+10)
following values of gain, K: 20, 50, 85, 200, and 700
3. Using MATLAB’s SISO Design Tool, set up a negative unity feedback system with
43
G(s)
𝐾(𝑠+6)
= to produce a root locus. For convenience, set up the zero to -6 on the
resulting
𝑠(𝑠+0.5)(𝑠+10)
root locus. Print the root locus for the zero at -6.Move the zero to the following locations
and print out a root locus at each location: -2, -1.5, -1.37, and -1.2.
4. Sketch the root locus for the system shown in Fig. 7.4 and find the following:
a. The exact point and gain where the locus crosses the 0.45 damping ratio line.
b. The exact point and gain where the locus crosses the jw-axis.
c. The breakaway point on real axis.
d. The range of K within which the system is stable.
44
k(s − 2)(s− 4)
𝐺(𝑠) = s2 + 6s + 24
I. Sketch the root locus.
II. Find the imaginary-axis crossing.
III. Find the gain, K, at the jw-axis crossing.
IV. Find the break-in point.
V. Find the point where the locus crosses the 0.5 damping ratio line.
VI. Find the gain at the point where the locus crosses the 0.5 damping ratio
line. VII. Find the range of gain K, for which the system is stable.
6. Sketch the root locus by designing the system shown in Fig. 7.5
Answers:
Answer: 1
• Zeros attract the root locus branches as the gain KKK increases.
• Zeros in the right-half plane (RHP) can make the system unstable, while those in the
left-half plane (LHP) contribute to stability.
• Root locus branches terminate at the zeros as K→∞K \to \inftyK→∞.
• Zeros near the origin reduce the rise time (faster response).
• Zeros close to poles can increase overshoot and reduce damping, causing oscillations.
• Farther zeros have minimal impact on the transient response.
Answer: 2
To predict or determine whether a root locus plot crosses the real axis, follow these steps:
45
2. Calculation of Crossing Point:
o Use the characteristic equation of the closed-loop system: 1+G(s)H(s)=01 + G(s)H(s) = 0
o Solve for ss on the real axis to find crossing points.
3. Verification via Breakpoints:
o Find breakpoints on the real axis by solving: dds(G(s)H(s))=0\frac{d}{ds} \left( G(s)H(s) \right) = 0
o These points help identify where the locus enters or exits the real axis.
Answer: 3
To ensure that the natural frequency (ωn\omega_n) does not change over a region of gain in the root locus:
By following these steps, you can maintain a constant natural frequency across a range of gain
values.
Answer: 4
Answer
Open-Loop System:
G(s)H(s)=K(s+2)(s+1)(s+5)G(s)H(s) = \frac{K(s+2)}{(s+1)(s+5)}
• Zero: s=−2s = -2
• Poles: s=−1,s=−5s = -1, s = -5
1. Rise Time: Zeros near the origin reduce rise time, making the response faster.
2. Overshoot: Zeros near poles increase overshoot and reduce damping.
3. Shape: Zeros shape the transient response by amplifying or suppressing certain frequency components.
46
Answer: 5
Steps and answers for the given unity feedback system with the transfer function:
• Substitute the imaginary-axis values into G(s)H(s)G(s)H(s) and solve for kk.
V. Find the Point Where the Locus Crosses the 0.5 Damping Ratio Line:
• Use the damping ratio equation: cos(θ)=ζ=0.5\cos(\theta) = \zeta = 0.5 Find the intersection of the root
locus with this angle from the origin.
VI. Find the Gain at the Point Where the Locus Crosses the 0.5 Damping Ratio Line:
• At the determined point, substitute into the characteristic equation to solve for kk.
47
VII. Find the Range of Gain KK, for Which the System is Stable:
• Stability requires all closed-loop poles to be in the left-half plane. Analyze the root locus and find the
range of kk that ensures this condition.
Answer: 6
import numpy as np
# Define the transfer function G(s) = K(s + 3) / [s(s + 1)(s + 2)(s + 4)]
numerator = [1, 3] # (s + 3)
plt.figure(figsize=(10, 6))
rlocus(system, grid=True)
plt.xlabel("Real Axis")
plt.ylabel("Imaginary Axis")
plt.show()
48
Experiment No. 8
8.1 Objective Improvement in transient and steady state error via lead and
lag compensators.
8.3 Theory
A lead–lag compensator is a component in a control system that improves an
undesirable frequency response in a feedback and control system. It is a fundamental
building block in classical control theory. Both lead compensators and lag
compensators introduce a pole–zero pair into the open loop transfer function. A system
which has one pole and one dominating zero (the zero which is closer to the origin than
all over zeros is known as dominating zero.) is known as lead network. If we want to
add a dominating zero for compensation in control system then we have to select lead
compensation network. A system which has one zero and one dominating pole (the
pole which is closer to origin that all other poles is known as dominating pole) is known
as lag network. If we want to add a dominating pole for compensation in control system
then, we have to select a lag compensation network.
A type of compensator that can accomplish both of our goals is a lead compensator. A
lead compensator adds positive phase to the system. Additional positive phase
increases the phase margin, thus, increasing the damping. The lead compensator also
generally increases the magnitude of the open-loop frequency response at higher
frequencies, thereby, increasing the gain crossover frequency and overall speed of the
system. Therefore, the settling time should decrease as a result of the addition of a lead
compensator. The general form of the transfer function of a lead compensator is
𝐶(𝑠) = 𝐾 (𝑠 + 𝑧)/ 𝑠 + p
49
And for Lag compensator the transfer function is
Lead and lag compensators are used quite extensively in control. A lead compensator
can increase the stability or speed of response of a system; a lag compensator can
reduce (but not eliminate) the steady-state error. Depending on the effect desired, one
or more lead and lag compensators may be used in various combinations.
8.4 Pre-Lab
1. Students must be familiar with the MATLAB control systems tool box.
2. Students must read the chapter 9 of the text book “Norman S Nise”.
8.5 Procedure
• Open the control design GUIs by typing the following in the MATLAB
command window “sisotool”.
• Define the control architecture for your system.
• Specify the plant model and initial guesses for the compensator elements in the
control architecture.
• Evaluate the system's closed-loop performance.
• Display specific performance characteristic for your system. Compare values
to design requirements.
• Refine compensator design using graphical tuning.
• In a design plot, modify the compensator by adding poles, zeros, lead, and lag,
for example. To do this, right-click to add dynamic elements in the controller
structure.
o Add a new pole, for example, by clicking the pole location on the plot. o
Modify the compensator structure by moving the poles, zeros, and other dynamic
elements directly on the plot.
Lab Task 1:
To perform a lead compensation. To design a PI controller and see its effect
upon steady-state error.
1. Design a lead compensator for a unity negative feedback system with a
forward transfer function of G(s) = 𝐾 to meet the following
specifications: percent
𝑠(𝑠+3)(𝑠+6)
overshoot = 20%; settling time = 2 seconds. Specify the required gain, K.
Estimate the validity of the second-order approximation.
2. What is the total angular contribution of the lead compensator?
50
3. Determine the pole and zero of two more lead compensators that will
meet the requirements of Task 1.
4. What is the expected steady-state error for a step input for each of the
lead compensated systems?
5. What is the expected steady-state error for a ramp input for each of the
lead compensated systems?
Lab Task 2:
1. Using the SISO Design Tool, create the design in Task 1 and plot the root locus,
step response, and ramp response. Take data to determine the percent overshoot,
settling time, and step and ramp steady-state errors. Record the gain, K.
2. Plot the step and ramp responses for two more values of the PI controller zero.
Lab Task 3:
A unity feedback system with the forward transfer function
G(s) =K s(s + 7)
Is operating close-loop step response that has 15% overshoot. Do the following
a) Evaluate the settling time
b) Design a lead compensator to decrease the settling time by three times. Choose
the compensator’s zero to be at -10.
51
8.8 Exercise Questions
1. Why do we use a phase lag compensators in control system design?
2. How can we design the compensator using frequency response?
3. How can we improve the transient response of the system by designing the
compensators?
Answers:
Answer: 1
Phase lag compensators are used in control system design primarily to improve the stability of
the system while achieving better performance in the frequency domain. They provide the
following benefits:
• Stabilize the system: By modifying the phase characteristics of the open-loop transfer
function, phase lag compensators help in reducing the phase shift and improving system
stability.
• Improve steady-state error: These compensators are effective in improving the steady-
state performance, especially for systems requiring better tracking of reference signals.
• Minimal effect on bandwidth: Unlike phase lead compensators, phase lag compensators
do not significantly increase the system bandwidth, allowing the system to maintain its
overall frequency response characteristics.
• Shape the frequency response: Phase lag compensators mainly adjust the low-frequency
response to reduce errors without compromising the stability margins.
Answer: 2
To design a phase lag compensator using frequency response, we follow these general steps:
• Determine the desired phase margin and crossover frequency: First, identify the
phase margin and desired gain crossover frequency for the system. Phase lag
compensators are typically used when the system requires more phase margin to avoid
instability.
• Select a compensator structure: The phase lag compensator is typically represented by
the transfer function:
where TTT is a time constant and α\alphaα is the design parameter, with α>1\alpha >
1α>1.
52
• Plot the open-loop frequency response: Plot the Bode plot for the open-loop transfer
function, and observe the phase and gain characteristics. The phase lag compensator can
be adjusted to add the desired phase shift at the low-frequency region without affecting
the high-frequency behavior significantly.
• Adjust the compensator parameters: Tune TTT and α\alphaα such that the
compensator introduces the required phase shift at the appropriate frequencies while
improving the phase margin without significantly altering the system bandwidth.
Answer: 3
Designing compensators can significantly improve the transient response of a control system:
53
Experiment No. 9
9.2 Equipment
PC and MATLAB® R2017b
9.3 Theory
PID control (Proportional, Integral and Derivative control) is a widely used control
algorithm. It can be used to control position of an object, temperature of an oven,
speed of a car and so on. Here it is used it to control the position of a magnet in air.
The command “SISO tool” opens a SISO Design GUI for interactive compensator
design. This GUI allows you to design a single-input/single-output (SISO)
compensator using root locus, Bode diagram, Nichols and Nyquist techniques. You
can also automatically design a compensator using this GUI.
9.4 Pre-Lab
1. Chapter No 8 & 9 (Norman S Nise)
2. Hands on experience on Simulink and MATLAB Programming
9.5 Procedure
1. Open the control design GUIs by typing the following in the MATLAB
command window “sisotool”.
2. Define the control architecture for your system.
3. Specify the plant model and initial guesses for the compensator elements in the
control architecture.
4. Design a compensator using automated tuning, for example PID Tuning
5. Evaluate the system's closed-loop performance.
6. Display specific performance characteristic for your system. Compare values
to design requirements.
7. Refine compensator design using graphical tuning.
8. In a design plot, modify the compensator by adding poles, zeros, lead, and lag,
for example. To do this, right-click to add dynamic elements in the controller
structure.
a. Add a new pole, for example, by clicking the pole location on the plot.
b. Modify the compensator structure by moving the poles, zeros, and
other dynamic elements directly on the plot.
54
Lab Task 1:
For the transfer function specified below for Magnetic Levitation System,
Gp(s) =
0.
Design a controller which will meet the following requirements
a. Settling Time = 0.2 sec
b. Percentage Overshoot = 10%
c. Assume controller zero at -23.424
Steps:
1. Find open loop response.
2. Develop the close loop system and find whether changing gain (K) can fulfill
the requirements.
3. If step 2 is unsatisfactory the add zero at location mentioned. Then add pole on
real axis and by hit and trial adjust its position so that the root locus pass through
the design point.
4. Simulate your design in Simulink.
Lab Task 2:
For the transfer function specified below for Inverted Pendulum System,
Gc(s) = 3/(s2-29.4)
Steps:
1. Find open loop response.
2. Develop the close loop system and find whether changing gain (K) can fulfill the
requirements.
3. If step 2 is unsatisfactory the add zero at location mentioned. Then add pole on
real axis and by hit and trial adjust its position so that the root locus pass through
the design point.
4. Simulate your design in Simulink.
Lab Task 3:
55
For the transfer function specified below for Ball and a Beam System,
Steps:
1. Find open loop response.
2. Develop the close loop system and find whether changing gain (K) can
fulfill the requirements.
3. If step 2 is unsatisfactory the add zero at location mentioned. Then add
pole on real axis and by hit and trial adjust its position so that the root locus pass
through the design point. 4. Simulate your design in Simulink.
To create a transfer function in the SISO tool (such as in MATLAB or Simulink), follow these
steps:
• Open the SISO tool: In MATLAB, you can open the SISO tool by typing sisotool in
the command window.
• Create a system:
o In the SISO tool, go to the 'File' menu and choose 'New' to start a new system.
o You can define your system by either:
▪ Manually entering a transfer function:
▪ In the Transfer Function Editor, you can input the numerator and
denominator of your transfer function. For example, for
G(s)=s+1s2+3s+2G(s) = \frac{s+1}{s^2 + 3s +
56
2}G(s)=s2+3s+2s+1, input 1 1 for the numerator and 1 3 2 for
the denominator.
▪ Use predefined blocks: Use blocks like Gain, Sum, Integrator, etc.,
from the SISO tool’s interface to build up your system.
• Define system dynamics: Once the transfer function is created, you can analyze the
system’s response (step response, frequency response, etc.) using the tool.
Answer: 2
To set and adjust parameters like settling time, overshoot, etc., in the SISO tool:
• Open the Control System Toolbox: In the SISO tool window, you will typically see
options to modify the system response and gain margins.
• Set parameters via the Bode or Root Locus Plot:
o Settling Time: In the Time Response tab, look for the Step Response or
Impulse Response of your system. The settling time (typically defined as the
time it takes for the system to remain within 2% of the final value) can be
visualized here.
o % Overshoot: In the Step Response plot, the maximum peak value relative to
the final value will give you the percentage overshoot.
• Adjust Compensator (if applicable): You can adjust the proportional (K), integral (I),
and derivative (D) values (for PID control) or the phase lag/lead compensators to tune
the system. Iteratively adjust these values to achieve the desired specifications:
o Increase the gain to reduce rise time, or adjust the phase to affect the overshoot
and settling time.
Answer: 3
To adjust the axes and get a suitable view of the graph in the SISO tool:
• Zoom in or out:
o Click on the axes of the plot (such as the step response or Bode plot). Use your
mouse wheel to zoom in or out, or drag the plot to reposition the view.
• Manually adjust axes limits:
o Right-click on the plot (or use the plot settings in the SISO tool) and select Axes
Properties or Set Axes Limits.
o Adjust the X-axis and Y-axis limits as needed to focus on specific regions of the
graph.
o For example, if you’re analyzing the Step Response, adjust the time axis to see
the transient behavior more clearly.
• Auto-scaling: The SISO tool usually provides an Auto-scale option. If you choose this,
the graph will automatically adjust the axes to fit the plot perfectly for all relevant data.
• Customize grid and labels: You can also add or remove grids, change tick marks, and
customize the labels for better clarity.
57
58
Experiment No. 10
10.2 Equipment
PC and MATLAB® R2017b
10.3 Theory
In control theory, a state observer is a system that provides an estimate of the internal
state of a given real system, from measurements of the input and output of the real
system. It is typically computer-implemented, and provides the basis of many
practical applications, for example stabilizing a system using state feedback. In most
practical cases, the physical state of the system cannot be determined by direct
observation.
10.4 Pre-Lab
1. Student should be familiar of term “state space”, Controller,
Observer and MATLAB.
2. Students must read the state space design section of the text book
(Norman S.Nise).
10.5 Procedure
1. Make an m. file to calculate the controller gains from the system matrix
(F) using the Command K=acker (F, G, poles).
2. Include L=acker (F’, H’, poles)’ in your m file to find the observer gains.
3. Check the controllability and observability the system by finding the
ranks of controllability and observability matrices respectively.
4. Run your m.file.
5. In SIMULINK design a controller and import the parameters from the
workspace. State space modeling of dynamic LTI systems allows the control
system designer to bring the vast array of tools from linear system theory to
bear on the design problem. It is important to note that the state space
representation is not unique, i.e. there are many state-space representations for
the same system. The MATLAB command gives just one possible state-space
equation.
ss conversion to state-space
59
ss2tf conversion of state-space to transfer function
tf2ss conversion of transfer function to state-space
ssdata extraction of state-space data from a SYS
model
rss random stable state-space models
ss2ss state transformations
canon canonical state-space realizations
ctrb controllability matrix
obsv observability matrix
[𝐴,𝐵,𝐶,𝐷] = 𝑡𝑓2𝑠𝑠(𝑛𝑢𝑚,𝑑𝑒𝑛)
Convert the following transfer function into state space by hand and using m file
Obtain the transfer function of the following state-space equations by hand and using m
files
60
Controllability & Observability matrices:
Lab Task 1:
Lab Task 2:
61
Cruise Control system
1) Given the plant of cruise control system
1
𝑉(𝑠) 𝑚
𝑈(𝑠) = 𝑠 + 𝑏
𝑚
To design a full-order observer (or estimator) with estimator-error poles at −12±12j-12 \pm 12j,
follow these steps:
1. System Setup: Consider the system dynamics of a state-space model in the form:
where x(t)x(t) is the state vector, u(t)u(t) is the input, and AA and BB are system
matrices.
2. Designing the Estimator: The full-order observer (or estimator) is designed to estimate
the system state vector x^(t)\hat{x}(t) from the outputs y(t)y(t). The observer dynamics
are given by:
e˙(t)=(A−LC)e(t)\dot{e}(t) = (A - LC)e(t)
The goal is to place the poles of the error dynamics at −12±12j-12 \pm 12j. These poles
correspond to a complex conjugate pair with a real part of −12-12 and an imaginary part
of 1212.
4. Determine the Observer Gain LL: The eigenvalues of the matrix A−LCA - LC must
match the desired poles. To achieve this, you can use pole placement or LQR-based
methods to compute the observer gain LL.
If you are working in MATLAB, you can use the place command to compute the gain
LL:
This will provide you with the appropriate observer gain matrix LL, which will place the
estimator-error poles at −12±12j-12 \pm 12j.
Answer: 2
b. Compare the Major Difference in the Transient Response of an Observer to that of a Controller.
Why Does This Difference Exist?
There are key differences in the transient responses of an observer and a controller. Here’s a
comparison and explanation for the difference:
• Purpose: The observer is used to estimate the state of a system when the states are not directly
measurable.
• Transient Behavior: The observer dynamics are designed to have specific poles (often placed at faster or
more stable locations compared to the system poles) to ensure quick convergence of the state estimation
error. In your case, the observer-error poles are placed at −12±12j-12 \pm 12j, which corresponds to a
high-frequency oscillation, ensuring that the error decays rapidly.
• Effect on System: The observer is not directly controlling the system but instead tracks the state of the
system based on the system output and input. Its response is solely concerned with accurately estimating
the state as quickly as possible.
63
2. Controller Transient Response:
• Purpose: A controller is designed to drive the system output to a desired value (typically zero or a
reference signal) by manipulating the system's input.
• Transient Behavior: The controller dynamics influence both the system’s state and its output. The poles
of the controller are typically designed to balance fast response (low overshoot and short settling time)
with system stability.
• Effect on System: The controller has a direct effect on the system's dynamics and is responsible for
regulating the system's behavior over time. The transient response is more closely related to performance
criteria such as overshoot, settling time, and rise time.
• Control vs. Estimation: The primary difference exists because the observer is focused on estimation (how
quickly and accurately the observer can estimate the system states), while the controller is focused on
controlling the system output (how quickly and accurately the system can reach a desired state or
output).
• Response Objectives: The observer typically has poles that are faster or chosen to decay quickly to reduce
the error between the actual state and the estimated state. However, the controller is designed to ensure
the system output tracks a reference or follows a setpoint in an optimal way. Therefore, the transient
response of the controller is more concerned with system stability, output performance, and external
disturbances, while the observer is concerned only with the internal state estimation error.
• Coupling of the Control Law and Estimator: In a typical system with both a controller and an observer
(like a state feedback control with an observer), the observer tracks the state of the system, and the
controller uses this estimated state to compute the control input. The transient responses of the observer
and the controller, though related, serve different roles in the system’s behavior.
64
Experiment No. 11
Frequency Response
11.1 Objectives
To examine the relationships between open-loop frequency response and stability,
openloop frequency response, closed-loop transient response, the effect of additional
closedloop poles and zeros upon the ability to predict closed-loop transient response.
11.2 Equipment
PC and MATLAB® R2017b
11.3 Theory
This experiment presents the design of feedback control systems through gain
adjustment and compensation networks from another perspective— that of frequency
response. The results of frequency response compensation techniques are not new or
different from the results of root locus techniques. Frequency response methods,
developed by Nyquist and Bode in the 1930s, are older than the root locus method,
which was discovered by Evans in 1948 (Nyquist, 1932; Bode, 1945). The older
method, which is covered in this chapter, is not as intuitive as the root locus.
However, frequency response yields a new vantage point from which to view
feedback control systems. This technique has distinct advantages in the following
situations:
1. When modeling transfer functions from physical data.
2. When designing lead compensators to meet a steady-state error
requirement and a transient response requirement.
3. When finding the stability of nonlinear systems.
4. In settling ambiguities when sketching a root locus.
11.4 Pre-Lab:
1. Chapter no.10 of the text book ‘Norman S Nise ‘. 2.
Student should be familiar with the usage of MATLAB.
11.5 Procedure
1. First of all open MATLAB m.file.
2. Write a code for Nyquist plot.
Example 1:
Plot the Nyquist response of the system.
2s2 + 5s + 1
H(s) = s2 + 2s + 3
MATLAB Code:
65
𝐻 = 𝑡𝑓([2 5 1],[1 2 3]);
𝑛𝑦𝑞𝑢𝑖𝑠𝑡(𝐻)
Example 2:
Obtain Nyquist Plot of a unity feedback system system having forward path
transfer function of
G(s) =
s
MATLAB Code:
𝑛𝑢𝑚 = [1]
𝑎 = [1 0]
𝑏 = [1 2 2]
𝑑𝑒𝑛 = 𝑐𝑜𝑛𝑣(𝑎,𝑏)
𝑔 = 𝑡𝑓(𝑛𝑢𝑚,𝑑𝑒𝑛)
𝑛𝑦𝑞𝑢𝑖𝑠𝑡(𝑔)
Output:
66
Figure: 11.2 Nyquist plot (Output).
Experiment
Lab Task:
Sketch the Nyquist diagram for a unity negative feedback system with a forward transfer
function of G(s) = K/ s(s+2)(s+10)
1. From your Nyquist plot, determine the range of gain, K,
for stability.
2. Find the phase margins required for second-order closed-loop step responses
with the following percent overshoots: 5%, 10%, 20% and 30%.
3. Using the SISO Design Tool, produce the following plots simultaneously for
the system of TASK 1: root locus, Nyquist diagram, and step response. Make plots for
the following values of K: 50, 100,
Using the SISO Design Tool, produce Bode plots and closed-loop step responses for a
unity negative feedback system with a forward transfer function of G(s) = K 2/ s(s+10)
K
G(s) =
(s + 2)(s + 4)(s + 6)
2. Using the Nyquist criterion, find the range of K for by designing the systems in
Fig. 11.4 and Fig. 11.5.
68
1. What is nyquist contour?
2. What is polar plot? How it differs from Nyquist plot?
3. Obtain Nyquist Plot of the following transfer function. Also verify your result
theoretically?
(s + 8)
G(s) =
s(s+ 3)(s + 6)
69
Experiment No. 12
12.1 Objective
1. Mathematical modeling of magnetic levitation system.
2. To familiar the students with the magnetic levitation system.
3. How the gains of PID affect the magnetic levitation system behavior.
12.2 Equipment
• PC and MATLAB® R2017b
• Hardware setup of Magnetic Levitation System
12.3 Theory
Magnetic levitation is a method of levitating a metallic object against the gravity using
them a genetic force. This can be achieved either by them a genetic repulsion or
magnetic attraction phenomenon. Permanent magnets can be used forth is purpose but
to have proper levitation, a control over the magnetic force must be there to reduce
the external disturbances. That’s why most of the systems use electromagnets for
levitation and control. Maglev systems have their applications in especially in Maglev
trains, Maglev bearings, Maglev in wind turbine & Research works in cell growth
related to microbiology.
The GML control system is a platform for the research of magnetic levitation technology. It
is a typical suction levitation system; the system configuration is shown in below Fig. 12.2.
70
Figure: 12.2 Suction levitation system.
𝐺𝑐(𝑠) =
12.4 Pre-Lab
1. Chapter No 9 (Norman S Nise).
2. Hands on experience on Simulink and MATLAB Programming.
12.5 Procedure
Root Locus Real Time Control Experiment
Please install Googol MATLAB real control software before experiment. Details
please refer to GML system installation manual.
1. Open MATLAB and Simulink as follow:
71
Figure: 12.3 MATLAB simulink.
4. Click“ ”to build, after successful build there will be information notice in
MATLAB command window as follow (If the control interface structure is not
changed, not further build is needed after run once:
If not successful, please refer to Googol Technology MATLAB Real Time Control
Software User Manual to find out the reason.
72
5. Select external mode “External” and click“ ”to connect;
Click “ ”to run;
6. When program is running, the electromagnetic force will be detected around
the electromagnet.
7. Put the steal ball to the expected position under electromagnet by hand. When
the program starts to run, loosen the ball gradually.
8. Add “Scope” to view the experiment data:
9. Double click “Manual Switch” to switch controller, observe the experiment
data and record. The system response under certain disturbances can be observed:
10. Users can also save the experiment data as file or output to MATLAB
“Workspace” as follow. Details please refer to MATLAB references.
12.6 Observations and Results All questions should be answered precisely to get
maximum credit. Lab report must ensure following items:
Lab objectives
MATLAB codes/Simulink
snap shots of hardware setup
Conclusion
73
12.8 Exercise Questions
1. What kind of compensation improves the steady-state error?
2. What kind of compensation improves transient response?
3. What kind of compensation improves both steady-state error and
transient response?
4. Cascade compensation to improve the steady-state error is based upon
what pole-zero placement of the compensator? Also, state the reasons for this
placement.
74
Experiment No. 13
Inverted Pendulum
13.1 Objective
1. Hardware setup is used to teach physically the basis of control engineering.
2. Overview to Inverted Pendulum Control Module.
13.2 Equipment
• PC and MATLAB® R2017b
• Hardware setup of Inverted Pendulum
13.3 Experiment purpose for Automatic Control Theory
The Automatic Control Theory is the core fundamental course for the major of
Automatic Control and compulsory course for the motor related majors, and it is one
of the most effective ways to master the methods of control system analysis and
design.
The main purpose of this experiment is to, through experiment, further the
understanding of the basic concept of automatic control theory, get familiar with and
master the analysis and design method of control system, and know such commonly-
used engineering software as MATLAB and LabView etc.
This experiment, with the object of the linear 1-stage inverted pendulum-typical
control theory experiment equipment; aims to have the student understand and master
the basic principle and application method for automatic control theory through the
control of pendulum bar angle and cart's position. This experiment covers the root
locus analysis and control of Inverted Pendulum System.
The linear 1-stage inverted pendulum system may be abstracted into a system
composed of cart and uniform bar after the ignorance of air resistance and various
friction forces, and it is shown in Fig. 13.1.
𝐺𝑐(𝑠) = s − 29.4
13.4 Pre-Lab
75
1. Capability of handling GUI based software
2. Basics of Inverted Pendulum
13.5 Procedure
1. Switch on the power button on the electric cabinet of the inverted pendulum,
then place the inverted pendulum cart at the mid of the guide rail.
2. Open file “Root Locus Control.mdl” in MATLAB/Current Folder, then the real
control page as shown in Fig. 13.2 below will pop up.
76
4. Click on “ ”icon to link the programs, when the buzzing generated from the
motor after servo would be heard.
5. Click on “ ”button to operate the program, then manually place the pendulum
bar to the straight up position, when the program would enter control state. Hold the
pendulum bar and maintain it at the mid of the guide rail.
6. Double click on the “Step Switch” to stimulate the input signal to the
0.05m/s2end, hold the pendulum bar still for 10s, and then observe the motion with
hands off.
7. Click on button to stop the program, and double click on the "Step" and
"Angle" oscilloscopes to observe the response of system output in Angle when the
signal in Step in switched into 0.05m/s2.
77
Experiment No. 14
14.2 Equipment
PC and MATLAB® R2017b.
14.3 Theory
A proportional–integral–derivative controller (PID controller) is the most commonly
used feedback controller in industrial control systems. A PID controller calculates an
error value as the difference between measured output and a desired set point. The
controller attempts to minimize the error by adjusting the process control inputs. The
popularity of PID controller can be attributed partly to their robust performance in a
wide range of operating conditions and partly to their functional simplicity, which
allows engineers to operate them in a simple and straightforward manner.
14.4 Pre-Lab
1. Chapter No 9 (Norman S Nise).
2. Hands on experience on Simulink and MATLAB Programming.
14.5 Specifications
1. Find out the modelling equation of a given mass spring damper model
2. Find The transfer function between the displacement X(s) and the input
F(s)
Let
• 𝑀 = 1𝑘𝑔
• 𝑏 = 10 𝑁.𝑠/𝑚
• 𝑘 = 20 𝑁/𝑚
• 𝐹(𝑠) = 1
78
Mass-Spring-Damper Model
14.6 Procedure
Students are required to come up with their own procedure to complete the above
specification.
Lastly, keep in mind that you do not need to implement all three controllers
(proportional, derivative, and integral) into a single system, if not necessary. Design
the appropriate controller to meet the required objectives. For example, if a PI
controller gives a good enough response (like the above example), then you don't
need to implement a derivative controller on the system. Keep the controller as
simple as possible.
80
Experiment 15
THEORY: The time response has utmost importance for the design and analysis of control
systems because these are inherently time domain systems where time is independent
variable. During the analysis of response, the variation of output with respect to time can be
studied and it is known as time response. To obtain satisfactory performance of the system
with respect to time must be within the specified limits. From time response analysis and
corresponding results, the stability of system, accuracy of system and complete evaluation
can be studied easily. Due to the application of an excitation to a system, the response of
the system is known as time response and it is a function of time. The two parts of response
of any system:
Transient response: The part of the time response which goes to zero after large interval of
time is known as transient response.
Steady state response: The part of response that means even after the transients have died
out is said to be steady state response.
The total response of a system is sum of transient response and steady state response:
C(t)=Ctr(t)+Css(t)
Time Response Specification Parameters: The transfer function of a 2-nd order system is
generally represented by the following transfer function:
The dynamic behavior of the second-order system can then be described in terms of two
parameters: the damping ratio and the natural frequency.
If the dumping ratio is between 0 and 1, the system poles are complex conjugates and lie in
the left-half s plane. The system is then called underdamped, and the transient response is
oscillatory. If the damping ratio is equal to 1 the system is called critically damped, and
when the damping ratio is larger than 1 we have overdamped system. The transient
response of critically damped and overdamped systems do not oscillate. If the damping
ratio is 0, the transient response does not die out.
81
Delay time (td)
The delay time is the time required for the response to reach half the final value the very
first time.
Rise time (tr)
The rise time is the time required for the response to rise from 10% to 90%, 5% to 95%, or
0% to 100% of its final value. For underdamped second-order systems, the 0% to 100% rise
time is normally used. For overdamped systems, the 10% to 90% rise time is commonly
used.
Peak time (tp)
The peak time is the time required for the response to reach the first peak of the overshoot.
Maximum (percent) overshoot (Mp)
The maximum overshoot is the maximum peak value of the response curve measured from
unity. If the final steady-state value of the response differs from unity, then it is common to
use the maximum percent overshoot.
Settling time (ts)
The settling time is the time required for the response curve to reach and stay within a
range about the final value of size specified by absolute percentage of the final value
(usually 2% or 5%). The settling time is related to the largest time constant of the control
system.
82
83