0% found this document useful (0 votes)
25 views

Control System Manual

The document is a laboratory manual for the Control Technology course (BSBMET-164) at the University of Lahore, outlining various experiments related to control systems using MATLAB and Simulink. It includes a list of experiments, guidelines for laboratory procedures, safety precautions, and detailed instructions for performing tasks in MATLAB. The manual also covers theoretical concepts, practical applications, and exercises related to control systems and MATLAB commands.

Uploaded by

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

Control System Manual

The document is a laboratory manual for the Control Technology course (BSBMET-164) at the University of Lahore, outlining various experiments related to control systems using MATLAB and Simulink. It includes a list of experiments, guidelines for laboratory procedures, safety precautions, and detailed instructions for performing tasks in MATLAB. The manual also covers theoretical concepts, practical applications, and exercises related to control systems and MATLAB commands.

Uploaded by

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

Control Technology

BSBMET-164 Course Code

Laboratory Manual

Submitted by:-
Mughees Mehdi
70135670
BMET 5

Department of Technology

The University OF Lahore


List of Experiments
Page No.
No. Title of Experiment
1 Using MATLAB for Control Systems 1
2 Mathematical Modeling of Physical systems using SIMULINK 10
3 To Measure Time-Domain Performance of the System 16
4 Block Diagram Reduction 19
5 Stability of a System 24
6 Steady State Error 27
7 Root Locus 31
8 Lead and Lag Compensation 35
9 To Design a PD Controller Using SISO TOOL 38
10 Designing Controller and Observer in MATLAB 41
11 Frequency Response 45
12 Magnetic Levitation System 50
13 Inverted Pendulum 55
14 Step Response of Analog and Digital Motor Control 59
Module
15 Determination of step & impulse response for a 62
second order unity feedback system
Guidelines for Laboratory Procedure

• Before starting a new lab, you must always read the laboratory manual for that

experiment and the instructor will discuss the experiment with you.

• Attachments must be made for laboratory experiment done in the class.

• 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 actively participate in class and don’t hesitate to ask questions.

• 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

any time during the lab.

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:

• Remove your watch and jewelry and secure loose clothing.


• Turn off the power and unplug equipment before performing service.
• Take a note of all the exits in the room, and also take note of the location of fire
extinguishers in the room for the sake of fire safety.
• Try not to type continuously for extremely long periods.
• Look away from the screen once in a while to give your eyes a rest.
• Do not touch any exposed wires or sockets.
• Do not attempt to open any machines, and do not touch the backs of machines when they
are switched on.
• Do not spill water or any other liquid on the machine, in order to maintain electrical
safety.
• Turn off the machine you were using, when you are done using it.
• Do not access external devices without scanning them for computer viruses.
• Ensure that the temperature in the room stays cool, since there are a lot of machines
inside a lab, and these can overheat easily.
• Try not to touch any of the circuit boards and power sockets when something is
connected to them and switched on.
• Always maintain an extra copy of all your important data.
Experiment No. 1

Using MATLAB for Control Systems

1.1 Objective To introduce MATLAB and learn to represent and create polynomials
in MATLAB.

1.2 Equipment PC and


MATLAB® R2017b

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.4 Pre-Lab Preparations


Students must be familiar with operating system and basic computer fundamentals. The
purpose of this lab is to understand frequently used commands of control system toolbox

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.

Figure 1.2: How to start Simulink by writing Simulink in command prompt.

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

Figure 1.4: How to Start Creating Model in Simulink.


9. The following window appears. You may now drag the blocks you want to use
from the Simulink Library Browser to the model surface (or right-click on a block and
select “Add to…”) shown in Fig. 1.5.

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

Figure 1.6: Simulation configuration in Simulink.

4
Figure 1.7: Configuration window in Simulink.

Example No 1: Introduction to Simulink


1. Create the block diagram as shown in Fig. 1.8 in Simulink.
2. Set the following parameter for the Integrator block as given in Fig. 1.9.
3. The result should be like this as shown in Fig. 1.10.

Figure 1.8: How to create sine wave through Simulink modeling.

5
Figure 1.9: Parameter setting for integrator.
.

Figure 1.10: Sine wave generated by Simulink.

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.

Lab Task 1: Polynomials

Consider the two polynomials p(s) = 𝑠2 + 2s + 1 and q(s) = s + 1. Using MATLAB


compute,
• P(s) ∗ q(s)
7
• Roots of p(s)and q(s)
• p(−1)and q(6)

Lab Task 2: MATLAB (Simulink)


Implement the following models in Simulink and produce the output.

I.

Figure: 1.11 Simulink Model .

II.

Figure: 1.12 Simulink Model.


III.

Figure: 1.13 Simulink Model.

Lab Task 3:
Find the overall transfer function𝐶(𝑠) = 𝐺1(𝑠). 𝐺2(𝑠) that shown in Fig. 1.14.

8
𝑅 (𝑠)

1
( s + 8) (s + 2)

Figure: 1.14 Simulink Model.

1.6 Observation and Results


You are required to provide the following in your lab report
Graphs of the outputs
MATLAB code for the lab tasks performed
Screenshots of the Simulink Models
Conclusion

1.8 Exercise Questions


• Develop an open loop system and show its significance?
• Revise the basic commands of MATLAB and explain briefly how it helps in
control systems?
• Develop a generalized closed loop system in the presence of disturbance?
• Develop a MATLAB command to find the partial fraction of the following

𝐵(𝑠) 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.

Significance of an Open Loop System:

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

Basic MATLAB Commands for Control Systems

MATLAB is widely used in control system analysis and design. Here are some basic MATLAB
commands relevant to control systems:

1. tf(): Creates a transfer function model.


o Example: sys = tf([1], [1 3 2]) creates a transfer function 1s2+3s+2\frac{1}{s^2 + 3s +
2}s2+3s+21.
2. feedback(): Computes the closed-loop transfer function.
o Example: sys_cl = feedback(sys, 1) computes the closed-loop transfer function of the
system sys with a unity feedback.
3. step(): Plots the step response of a system.
o Example: step(sys) will show the step response of the transfer function sys.
4. impulse(): Plots the impulse response of a system.
o Example: impulse(sys) will show the impulse response of the transfer function sys.
5. bode(): Plots the Bode plot of a system (frequency response).
o Example: bode(sys) plots the Bode diagram for the system sys.
6. pzmap(): Plots the poles and zeros of the system.
o Example: pzmap(sys) shows the pole-zero plot for the system sys.
7. nyquist(): Plots the Nyquist plot for the system.
o Example: nyquist(sys) generates the Nyquist plot of sys.
8. lqr(): Computes the optimal state feedback gain using Linear Quadratic Regulation
(LQR).
o Example: K = lqr(A, B, Q, R) calculates the gain matrix K.

These commands are useful for analyzing system stability, transient response, and performance
in control systems.

MATLAB CODE:

% Define the numerator and denominator of the transfer function

num = [1]; % Numerator: 1

den = [1 3 2]; % Denominator: s^2 + 3s + 2

% Create the transfer function G(s)

G = tf(num, den);

% Display the transfer function

disp('Open-Loop Transfer Function:');

10
disp(G);

% Plot the step response

figure;

step(G);

title('Step Response of the Open-Loop System');

% Plot the Bode plot (frequency response)

figure;

bode(G);

title('Bode Plot of the Open-Loop System');

% Plot the Pole-Zero map

figure;

pzmap(G);

title('Pole-Zero Map of the Open-Loop System');

Generalized Closed-Loop System in the Presence of Disturbance

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.

The closed-loop transfer function in the presence of disturbance D(s)D(s)D(s) is:

T(s)=G(s)1+G(s)H(s)T(s) = \frac{G(s)}{1 + G(s)H(s)}T(s)=1+G(s)H(s)G(s)

The output Y(s)Y(s)Y(s) is given by:

Y(s)=T(s)⋅R(s)+G(s)⋅D(s)Y(s) = T(s) \cdot R(s) + G(s) \cdot D(s)Y(s)=T(s)⋅R(s)+G(s)⋅D(s)

11
Where:

• R(s)R(s)R(s) is the reference input,


• T(s)T(s)T(s) is the closed-loop transfer function,
• G(s)G(s)G(s) is the system's transfer function,
• H(s)H(s)H(s) is the feedback transfer function,
• D(s)D(s)D(s) is the disturbance signal.

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.

MATLAB Command for Partial Fraction Decomposition

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.

Problem a) A(s)=s3+6s2+11s+62s3+5s2+3s+6A(s) = {s^3 + 6s^2 + 11s + 6}{2s^3 + 5s^2 + 3s +6}


A(s)=2s3+5s2+3s+6s3+6s2+11s+6
Matlab

% Define the numerator and denominator


num = [1 6 11 6]; % Coefficients of s^3 + 6s^2 + 11s + 6
den = [2 5 3 6]; % Coefficients of 2s^3 + 5s^2 + 3s + 6

% Compute partial fraction decomposition


[R, P, K] = residue(num, den);

% Display results
disp('Residues:');
disp(R);
disp('Poles:');
disp(P);
disp('Direct term:');
disp(K);

Problem b) B(s)=s2+21s+33s2(s+21)B(s) = \frac{s^2 + 21s +


33}{s^2(s+21)}B(s)=s2(s+21)s2+21s+33
Matlab

% Define the numerator and denominator for the second expression


num_b = [1 21 33]; % Coefficients of s^2 + 21s + 33
den_b = [1 21 0 0]; % Coefficients of s^2(s + 21)

% Compute partial fraction decomposition


[R_b, P_b, K_b] = residue(num_b, den_b);

% 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

Mathematical modeling of physical systems using SIMULINK

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.2 Equipment PC and


MATLAB® R2017b

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.2 Transfer Function Representation


A transfer function is a mathematical representation of the relationship between the input
and output of a system. This function allows separation of the input, system, and the output
into three separate and distinct parts. The function also allows us to algebraically combine
mathematical representations of subsystems to yield a total system representation. The
general form of a transfer function, H(s), is,
R(s)
H(s) =
E(s)
Where 𝑅(𝑠) 𝑎𝑛𝑑 𝐸(𝑠) are Laplace Transforms of Response (output) and Excitation
(input) respectively.

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
𝐿 + 𝑅𝑖 + ∫ 𝑖 𝑑𝑡 = 𝑒𝑖
𝑑𝑡 𝐶

Figure: 2.1 LRC circuit.

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
𝐸𝑖 (𝑠) 𝐿𝐶𝑠

2.3.4 Modelling a Translational Mechanical System


A shock absorber, commonly found in motorbikes and automobile, can be represented by
a mass-spring system shown in Fig. 2.2. This system can be mathematically modelled by
Newton’s second law of motion which states that the acceleration ′𝑎′ of a body is parallel
and directly proportional to the net force F acting on it and inversely proportional to the
mass M of the body.

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

𝐹𝑓(𝑡) = 𝑏𝑣(𝑡) (2.6)

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.

Finally from Newton’s second law of motion we know that

∑ 𝐹 = 𝑀𝒂 (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 + 𝑏 𝑑𝑡 + 𝑘𝑥(𝑡) = 𝐹𝑎(𝑡)

Equation (2.10) is a second-order linear constant-coefficient differential equation which


completely models the behaviour of the given shock absorber system. Converting it into
transfer function representation greatly eases the manipulation of the model and gives
extended liberty to investigate various hidden aspects of the system in rather greater detail.
To make transfer function out of equation (2.10) first we need to identify input and output
variables from the model and then we need to take Laplace Transform of the equation.
For the system given above we take applied force 𝐹𝑎to be input to the system and let
displacement 𝑥(𝑡) be out output. So after taking Laplace transform we get the following
expression assuming zero initial conditions.

𝑀𝑠2𝑋(𝑠) + 𝑏𝑠𝑋(𝑠) + 𝑘𝑋(𝑠) = 𝐹𝑎(𝑠) (2.11)

(𝑀𝑠2 + 𝑏𝑠 + 𝑘)𝑋(𝑠) = 𝐹𝑎(𝑠) (2.12)

Hence the transfer function 𝑋(𝑠) will be,


𝐹𝑎(𝑠)

𝑋(𝑠) 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

Figure: 2.3 Electrical circuit.

Figure: 2.4 Electrical circuit.

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

Figure: 2.5 Rotational mechanical systems.

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

2.7 Learning Outcomes


At the end of this experiment, students will be able to
1. Develop mathematical models of Electrical and Mechanical Systems in
MATLAB
2. Develop the transfer function of different systems and analyze their step
response

2.8 Exercise Questions


• Develop mathematical model of the given electronic network that are shown in Fig.
2.6. Represent this model in transfer function form and implement it on Simulink.

Figure: 2.6 Electronic Network.

Answers:

Step 1: Analyzing the Circuit

The given circuit is an op-amp configuration involving:

1. Input network: R1 and C1, forming an RC network.


2. Feedback network: R2 and C2, forming another RC network.
3. Operational amplifier: Used in an inverting configuration.

Step 2: Writing the Equations

For the input network:

19
The voltage V′ across the capacitor C1 is given by the impedance relation:

V′=Z1+R1Vin,V' = \frac{Z_1}{Z_1 + R_1} V_{\text{in}},V′=Z1+R1Z1Vin,

where Z1 is the impedance of the capacitor:

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.

For the feedback network:

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.

The impedance ZfZ_fZf of the parallel combination is:

Zf=R21+sR2C2.Z_f = \frac{R_2}{1 + sR_2C_2}.Zf=1+sR2C2R2.

The transfer function for the op-amp (inverting configuration) is:

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.

Combining Input and Feedback:

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

To implement this in Simulink:

1. Represent the transfer function: H(s)=−R2R1⋅1(1+sC1R1)(1+sR2C2).H(s) = -


\frac{R_2}{R_1} \cdot \frac{1}{(1 + sC_1 R_1)(1 + sR_2C_2)}.H(s)=−R1R2⋅(1+sC1R1
)(1+sR2C2)1. Use a Transfer Function block with:
o Numerator: [−R2/R1][-R_2 / R_1][−R2/R1],
o Denominator: [1,(C1R1+R2C2),C1R1R2C2][1, (C_1R_1 + R_2C_2),
C_1R_1R_2C_2][1,(C1R1+R2C2),C1R1R2C2].
2. Use a Signal Source block for VinV_{\text{in}}Vin.
3. Connect the blocks to observe VoutV_{\text{out}}Vout.

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.2 Equipment PC and


MATLAB® R2017b

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

output. e) Steady-State Error

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.

3.6 Observation and Results


You are required to provide the following in your lab report
Graphs of the outputs
MATLAB code for the lab tasks performed
Screenshots of the Simulink Models
Conclusion

3.7 Learning Outcomes


At the end of this experiment, students will learn
1. To predict the time response of a control system by addition of poles and zeros
to LTI systems.
2. To predict the settling time, peak time, percent overshoot, and rise time for an
underdamped Second-order system efficiently using MATLAB

3.8 Exercise Question


• To study the effects of damping ratio on the performance measures, consider the
following second-order single-loop unity feedback system that are shown in Fig. 3.2
Develop the step response of the system for values of 𝜔𝑛= 1 and ζ = 0.1, 0.4, 0.7, 1.0
and 2.0.

24
𝟐
+
R(s )
E(s)
𝑮(𝒔) = 𝒔(𝒔+𝟐𝛇𝒏𝛚 Y(s)
𝐧)

Figure: 3.2 Second-order Unity Feedback System.

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.

The series command is implemented as shown in Fig. 4.2:

Figure: 4.2 Implementation of series command.


b. Parallel configuration:
If the two blocks are connected as shown in Fig. 4.3 then the blocks are said to be in
parallel. It would like adding two transfer functions.

Figure: 4.3 Parallel configuration.

The MATLAB command for implementing a parallel configuration is “parallel” as shown in


Fig. 4.4

Figure: 4.4 Implementation of parallel command.


c. Feedback configuration:
If the blocks are connected as shown in Fig. 4.5 then the blocks are said to be in
feedback. Notice that in the feedback there is no transfer function H(s) defined.
When not specified, H(s) is unity. Such a system is said to be a unity feedback
system.

26
Figure: 4.5 Unity feedback system.
The MATLAB command for implementing a feedback system is “feedback” as shown in Fig. 4.6

Figure: 4.6 Implementation of Unity feedback system.

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

Figure: 4.7 Non-unity feedback system.


A non-unity feedback system is implemented in MATLAB using the same “feedback”
command as shown in Fig. 4.8

Figure: 4.8 Implementation of Non-unity feedback system.

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.

Figure: 4.9 Series configuration.


The result is as shown in Fig. 4.10

Figure: 4.10 Result of a series configuration.


Example 2: For the previous systems defined, modify the MATLAB commands to
obtain the overall transfer function when the two blocks are in parallel.
Example 3: Given a unity feedback system as shown in the Fig. 4.11, obtain the overall
transfer function using MATLAB.

Figure: 4.11 Unity feedback system.

28
The result is as shown in Fig. 4.12

Figure: 4.12 Result of a Unity feedback system.

Example 4: Given a non-unity feedback system as shown in the Fig. 4.13, obtain the
overall transfer function using MATLAB:

Figure: 4.13 Non-unity feedback system.

Figure: 4.14 Result of a Non-unity feedback system.

4.6 Observations and Results


All questions should be answered precisely to get maximum credit. Lab report must
ensure following items:
Lab objectives
MATLAB codes and Simulations
Results (graphs/tables) duly commented and discussed
Conclusion

4.8 Exercise Question


• Develop the equivalent transfer function, 𝑇(𝑠) = 𝐶(𝑠)/𝑅(𝑠) for the system that is shown
29
Figure: 4.15 Non unity feedback system.

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:

1. Label the Paths

• Let the system have the following components:


o G1(s)=sG_1(s) = sG1(s)=s (first forward block)
o G2(s)=1sG_2(s) = \frac{1}{s}G2(s)=s1 (next block in series)
o H1(s)=1sH_1(s) = \frac{1}{s}H1(s)=s1 (feedback block in the first loop)
o H2(s)=sH_2(s) = sH2(s)=s (feedback block in the second loop)

2. Forward Path Transfer Function

The forward path consists of G1(s)and G2(s in series:

G(s)=G1(s)⋅G2(s)=s⋅1s=1G(s) = G_1(s) \cdot G_2(s) = s \cdot \frac{1}{s} = 1G(s)=G1(s)⋅G2(s)=s⋅s1=1

3. Feedback Path Transfer Function

The feedback portion has two parts:

1. H1(s)=1sH_1(s) = \frac{1}{s}H1(s)=s1, the block in the first feedback loop.


2. H2(s)=sH_2(s) = sH2(s)=s, the block in the second feedback loop.

4. Closed-Loop Transfer Function (Non-Unity Feedback System)

The standard formula for a non-unity feedback system is:

T(s)=G(s)1+G(s)⋅H(s)T(s) = \frac{G(s)}{1 + G(s) \cdot H(s)}T(s)=1+G(s)⋅H(s)G(s)

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

Substitute these values:

T(s)=11+1⋅(1s+s)T(s) = \frac{1}{1 + 1 \cdot \left( \frac{1}{s} + s \right)}T(s)=1+1⋅(s1+s)1

5. Simplify the Denominator


T(s)=11+1s+sT(s) = \frac{1}{1 + \frac{1}{s} + s}T(s)=1+s1+s1

Combine terms:

T(s)=1s+1sT(s) = \frac{1}{\frac{s + 1}{s}}T(s)=ss+11

31
Simplify:

T(s)=ss+1T(s) = \frac{s}{s + 1}T(s)=s+1s

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

Stability is the most important system specification. If a system is unstable, transient


response and steady-state errors are moot points. An unstable system cannot be designed
for a specific transient response or steady-state error requirement. What, then, is
stability? There are many definitions for stability, depending upon the kind of system or
the point of view. In this section, we limit ourselves to linear, time-invariant systems.
Computer can be used to determine the stability by calculating the root locations of the
denominator of the closed-loop transfer function. Today some hand-held calculators can
evaluate the roots of a polynomial. There is, however, another method to test for stability
without having to solve for the roots of the denominator.

5.3.1 Stable System


All the roots of the characteristic polynomial lie in the left half plane (𝑅𝑒(𝑠 ) < 0).

5.3.2 Marginally stable system


32
No solution grows unbounded but some do not decay (𝑅𝑒(𝑠 ) ≤ 0).

5.3.3 Unstable system:


All the roots of the characteristic polynomial lie in the Right half plane (𝑅𝑒(𝑠 ) > 0).
Fig. 5.1 shows the stability of a system

Figure: 5.1 Stability of a system.

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)

Figure: 5.2 Feedback control system.

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)
𝒔(𝒔 + 𝟕)(𝒔 + 𝟏𝟏)
_

Figure: 5.3 Feedback control system.

5.6 Observation and Results


All questions should be answered precisely to get maximum credit. Lab report must ensure
following items:
Lab objectives
MATLAB codes and Simulations
Results (graphs/tables) duly commented and discussed
Conclusion

5.7 Learning Outcomes


At the end of this experiment student will be able to
1. Understand the role of pole zero location with respect to stability
2. Predict the stability of LTI system

5.8 Exercise Questions


• Predict the range of K for a stable operation?
• Predict the value of ‘K’ that yield the close-loop response unstable, stable with
over damped, Underdamped and Undamped in Fig. 5.4. Also plot the step response
for each value of ‘K’.

+ 𝑲
R(s ) C (s)
𝒔(𝒔 + 𝟕)(𝒔 + 𝟏𝟏)
_

Figure: 5.4 Feedback control system.


34
Answer:

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

Assuming H(s) = 1 (unity feedback), we get:

s^3 + 18s^2 + 77s + K = 0

Now, let's construct the Routh array:

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:

1. K > 0: This ensures that the s^0 row is positive.


2. 18*77 - K > 0: This ensures that the s^1 row is positive.

Combining these conditions, we get:

0 < K < 18*77

So, the range of K for stable operation is:

0 < K < 1386

Ans 2:Damping Characteristics

To determine the values of K that yield different damping characteristics, let's analyze the
characteristic equation:

s^3 + 18s^2 + 77s + K = 0

35
We can relate the coefficients of this equation to the standard form of a cubic polynomial:

s^3 + 2ζωn s^2 + ωn^2 s + ωn^3 = 0

where:

• ζ is the damping ratio


• ωn is the natural frequency

Comparing the coefficients, we get:

2ζωn = 18
ωn^2 = 77

Solving for ωn, we get:

ωn = √77 ≈ 8.77

Substituting ωn into the equation for ζ, we get:

ζ = 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 code snippet to simulate and plot the step response:

Matlab
% Define the transfer function
num = K;
den = [1 18 77 K];
sys = tf(num, den);

% Define the values of K


K_values = [100, 500, 1000, 1386];

% Simulate and plot the step response for each K


figure;
hold on;
for i = 1:length(K_values)
step(sys);
end
legend('K = 100', 'K = 500', 'K = 1000', 'K = 1386');
hold off;

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:

• The range of K for stable operation is 0 < K < 1386.


• The system is overdamped for all values of K within the stable range.
• The step response will exhibit varying degrees of overshoot and settling time as K
changes within the stable range.

Experiment No. 6

Steady State Error

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)

Figure: 6.1 Negative feedback system.

Where G(s) = K(s+6)/(s+4)(s+7)( s+9)(s+12) and H(s) = 1, calculate the steady-state error

In terms of K for the following inputs: 5u(t), 5tu(t), and 5t2u(t).

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

6.6 Observation and Results


You are required to provide the following in your lab report
Graphs of the outputs

38
MATLAB code for the lab tasks performed
Screenshots of the Simulink Models
Verification of results

6.7 Learning Outcomes


1. In this LAB students consider the role of steady state error of different systems.
2. In this LAB student learn to formulate steady state error constants across
different inputs.

6.8 Exercise Questions


Question 1:
Design the system given in Fig. 6.2 in Simulink and find the following for K=10 and
K=106

Figure: 6.2 Non-unity feedback system.


a) The system type
b) 𝐾𝑝 , 𝐾𝑣 and 𝐾𝑎
c) The steady-state error for inputs of 30𝑢(𝑡),30𝑡𝑢(𝑡), and 30𝑡2𝑢(𝑡).

Answer:

(a) System Type:

• System Type: 4 (4 integrators in the denominator of the open-loop transfer function).

(b) Error Constants:

• Position Constant (KpK_pKp): 118\frac{1}{18}181


• Velocity Constant (KvK_vKv): 000
• Acceleration Constant (KaK_aKa): 000
39
(c) Steady-State Errors:

1. For step input (30u(t)30u(t)30u(t)): 1819\frac{18}{19}1918


2. For ramp input (30tu(t)30tu(t)30tu(t)): ∞\infty∞
3. For parabolic input (30t2u(t)30t^2u(t)30t2u(t)): ∞\infty∞

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)

Figure: 7.1 A unity Feedback System.

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

>>𝑟𝑙𝑜𝑐𝑢𝑠 (𝑛𝑢𝑚,𝑑𝑒𝑛,𝐾)

If this command is invoked with left-hand arguments, like


[𝑟, 𝑘] = 𝑟𝑙𝑜𝑐𝑢𝑠(𝑛𝑢𝑚,𝑑𝑒𝑛)
[𝑟, 𝑘] = 𝑟𝑙𝑜𝑐𝑢𝑠(𝑛𝑢𝑚,𝑑𝑒𝑛,𝑘)
[𝑟, 𝑘] = 𝑟𝑙𝑜𝑐𝑢𝑠(𝑠𝑦𝑠)

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.

Figure 7.3: Block Diagram of the closed loop system.

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:

Figure 7.4: Block Diagram of the closed loop system.

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.

7.6 Observation and Results


You are required to provide the following in your lab report
Graphs of the outputs
MATLAB code for the lab tasks performed
Screenshots of the Simulink Models

7.7 Learning Outcomes


1. Use the root locus to design a parameter value to meet a transient response
specification for systems of order 2 and higher.
2. Find the root sensitivity for points along the root locus.

7.8 Exercise Questions


1. Design an open loop system and briefly describe how the zeros of the open-
loop system affect the root locus and the transient response?
2. How would you predict or determine whether or not a root locus plot crossed
the real axis?
3. How can you plan by considering the root locus that the natural frequency does
not changeover a region of gain?
4. Design an open loop system and briefly describe how the zeros of the open-
loop system affect the root locus and the transient response?
5. Given a unity feedback system that has the forward transfer function and
calculate following parameters.

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

Figure 7.5: Unity Feedback system.

Answers:
Answer: 1

• Effect of Zeros on Root Locus:

• 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→∞.

• Effect of Zeros on Transient Response:

• 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:

1. Rule for Real-Axis Segments:


o The root locus lies on the real axis where the total number of poles and zeros to the right of a
point on the real axis is odd.

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:

1. Focus on Circular Paths:


o Design the system so the root locus paths are arcs of a circle centered at the origin. This ensures
ωn\omega remains constant, as ωn\omega is the radial distance of the poles from the origin.
2. Pole Placement:
o Place poles symmetrically about the imaginary axis in the ss-plane. This keeps ωn\omega fixed
while gain KK varies.
3. System Design:
o Modify the system's open-loop transfer function G(s)H(s)G(s)H(s) to include properly placed
zeros and poles that force the locus to follow circular paths.

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

Effect of Zeros on Root Locus:

1. Zeros attract the root locus branches as KK increases.


2. Root locus branches terminate at finite zeros when K→∞K \to \infty.
3. Zeros closer to the imaginary axis influence the shape of the root locus and affect stability.

Effect of Zeros on Transient Response:

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:

G(s)=k(s−2)(s−4)s2+6s+24G(s) = \frac{k(s-2)(s-4)}{s^2 + 6s + 24}

I. Sketch the Root Locus:

1. Poles: s2+6s+24=0s^2 + 6s + 24 = 0 (Solve for poles: −3±j3-3 \pm j3)


2. Zeros: s=2,s=4s = 2, s = 4
3. Plot:
o Poles at −3+j3-3 + j3 and −3−j3-3 - j3
o Zeros at s=2s = 2 and s=4s = 4

II. Find the Imaginary-Axis Crossing:

• Use the characteristic equation: 1+G(s)H(s)=0⇒1+k(s−2)(s−4)s2+6s+24=01 + G(s)H(s) = 0 \quad


\Rightarrow \quad 1 + k \frac{(s-2)(s-4)}{s^2 + 6s + 24} = 0
• Solve for s=jωs = j\omega (imaginary axis crossing) by substituting s2=−ω2s^2 = -\omega^2.

III. Find the Gain, KK, at the jωj\omega-Axis Crossing:

• Substitute the imaginary-axis values into G(s)H(s)G(s)H(s) and solve for kk.

IV. Find the Break-In Point:

• The break-in (or breakaway) point is found by solving: dds((s−2)(s−4)s2+6s+24)=0\frac{d}{ds} \left(


\frac{(s-2)(s-4)}{s^2 + 6s + 24} \right) = 0

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

import matplotlib.pyplot as plt

from control import tf, rlocus

# Define the transfer function G(s) = K(s + 3) / [s(s + 1)(s + 2)(s + 4)]

numerator = [1, 3] # (s + 3)

denominator = [1, 7, 14, 8, 0] # s(s + 1)(s + 2)(s + 4)

system = tf(numerator, denominator)

# Plot the root locus

plt.figure(figsize=(10, 6))

rlocus(system, grid=True)

plt.title("Root Locus of the System")

plt.xlabel("Real Axis")

plt.ylabel("Imaginary Axis")

plt.axhline(0, color='black', linewidth=0.5, linestyle='--') # x-axis

plt.axvline(0, color='black', linewidth=0.5, linestyle='--') # y-axis

plt.show()

48
Experiment No. 8

Lead and Lag compensation

8.1 Objective Improvement in transient and steady state error via lead and
lag compensators.

8.2 Equipment PC and


MATLAB® R2017b

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.

A Lead Lag compensator is a component in control system that improves the


undesirable frequency response in a feedback and control system, It is a fundamental
building block in classical control theory. Lead Lag compensator are everywhere
influencing disciplines as varied as robotics, satellite control, automobile diagnostics,
laser frequency stabilization and many more.

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.

8.6 Observation and Results


All questions should be answered precisely to get maximum credit. Lab report must
ensure following items:
Lab objectives
MATLAB codes
Results (graphs/tables) duly commented and discussed
Conclusion

8.7 Learning Outcomes


1. To understand the design of lead compensators
2. To understand the design of the lag compensators 3. To design
the compensators using root locus techniques.

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:

C(s)=sT+1sαT+1C(s) = \frac{sT + 1}{s\alpha T + 1}C(s)=sαT+1sT+1

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:

• Phase lag compensators: While primarily aimed at improving steady-state performance,


they can also help in transient response by providing better phase margin, reducing
oscillations, and mitigating overshoot in the time-domain response.
• Phase lead compensators: For a more direct improvement in transient response (such as
reducing rise time or overshoot), phase lead compensators are often used in conjunction
with phase lag compensators. These compensators provide a boost in the system's high-
frequency gain, improving the speed of response.
• PID controllers: In more advanced cases, combining phase lag and phase lead
compensators with a proportional-integral-derivative (PID) controller can be used to
balance both transient and steady-state performance. This helps in reducing overshoot,
improving settling time, and minimizing steady-state errors.

53
Experiment No. 9

To Design a PD Controller Using SISO Tool


9.1 Objective
PID control for magnetic levitation, Inverted Pendulum and Ball & a Beam System
1. Using m-file in MATLAB
2. Using SISO TOOL box of MATLAB

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)

Design a controller which will meet the following requirements


a) Settling Time = 0.18 sec
b) Percentage Overshoot = 12.6 %
c) Assume controller zero at -5.42

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,

Design a controller which will meet the following requirements


a. Settling Time = 1 sec
b. Percentage Overshoot = 10%
c. Assume controller zero at -3.10057

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.

9.6 Observation and Results


All questions should be answered precisely to get maximum credit. Lab report must
ensure following items:
Lab objectives
MATLAB codes/Simulations
Results (graphs/tables) duly commented and discussed
Conclusion

9.7 Exercise Questions


1. How to create a transfer function in SISO tool?
2. How to set values for different parameters like settling time, %
overshoot etc.
in SISO tool.
3. How to adjust the axes for suitable view of graph?
Answers:
ANSWER: 1

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

Designing Controller and Observer in MATLAB


10.1 Objective
To simulate a system that has been designed for transient response via state-space
controller and observer.

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.

The following MATLAB commands can be used to state space representation

Table 10.1 MATLAB commands


Commands Explanation

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

Transfer function to state-space (tf2ss):


MATALB can be used to obtain a state-space representation of the transfer
function with the
following command

[𝐴,𝐵,𝐶,𝐷] = 𝑡𝑓2𝑠𝑠(𝑛𝑢𝑚,𝑑𝑒𝑛)

Convert the following transfer function into state space by hand and using m file

H(s) = s/(s+ 1)(s2 + 4s+ 16)

State-space to transfer function (ss2tf):


To obtain the transfer function from state-space equations, use the following MATLAB
code

[𝑛𝑢𝑚.𝑑𝑒𝑛] = 𝑠𝑠2𝑡𝑓(𝐴, 𝐵,𝐶, 𝐷)

Obtain the transfer function of the following state-space equations by hand and using m
files

60
Controllability & Observability matrices:

The controllability matrix, U, and observability matrix, V, are defined as,

U = [B A*B A^2*B ... A^(n-1)*B]


V = [C C*A C*A^2 ... C*A^(n-1)]' (note the transpose here)
• The MATLAB ctrb() and obsv() functions will create these matrices
automatically.
• Generate the controllability and observability matrices of 2-state mass spring
example given before using MATLAB functions ctrb() and obsv()
• Find the rank of the matrices. Is the system controllable or observable or both?
• Verify the MATLAB results by doing hand calculations

Lab Task 1:

1. Consider the transfer system of the antenna position control below:

G(S) = s1325 (s+ 1.71)(s+100)


Design a controller for given transfer function of antenna control to yield a 10%
overshoot and a settling time of 1 second. Place the third pole 10 times as far from
the imaginary axis as the second-order dominant pair. Assume that the state variables
of the plant are not accessible and design an observer to estimate the states. The
desired transient response for the observer is a 10 % overshoot and a natural
frequency 10 times as great as the system response above. As in the case of the
controller, place the third pole 10 times as far from the imaginary axis as the
observer’s dominant second-order pair.
2. What is the controller gain vector for your design of the system specified in the
TASK 1?
3. What is the observer gain vector for your design of the system specified in the
TASK 1?
4. Draw a Simulink diagram to simulate the system. Show the system, the
controller, and the observer using the physical variables specified in the TASK 1.
5. Using Simulink and your diagram from TASK 4, produce the Simulink diagram
from which you can simulate the response.
6. Produce response plots of the system and the observer for a step input.
7. Measure the percent overshoot and the settling time for both plots.

Lab Task 2:
61
Cruise Control system
1) Given the plant of cruise control system
1

𝑉(𝑠) 𝑚

𝑈(𝑠) = 𝑠 + 𝑏
𝑚

With mass=1580kg and b=26 N.sec/m


Design a controller to yield 9.5% overshoot and a settling time of 0.7 sec

10.6 Observation and Calculations


All questions should be answered precisely to get maximum credit. Lab report must
ensure following items:
Lab objectives
MATLAB codes/Simulations
Results (graphs/tables) duly commented and discussed Conclusion
10.7 Learning Outcomes
1. Design a state-feedback observer using pole placement for systems represented
in observer canonical form
2. Determine the role play by observability and controllability.

10.8 Exercise Questions


a. Design a full-order estimator with estimator-error poles are =-12±12j
b. Compare the major difference in the transient response of an observer to that
of a controller. Why does this difference exist?
Answers:
Answer: 1

a. Design a Full-Order Estimator with Estimator-Error Poles at -12±12j

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:

x˙(t)=Ax(t)+Bu(t)\dot{x}(t) = Ax(t) + Bu(t)

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:

x^˙(t)=Ax^(t)+Bu(t)+L(y(t)−Cx^(t))\dot{\hat{x}}(t) = A\hat{x}(t) + Bu(t) + L(y(t) - C\hat{x}(t))


62
where:

o x^(t)\hat{x}(t) is the estimated state,


o y(t)=Cx(t)y(t) = Cx(t) is the output,
o LL is the observer gain matrix, and
o CC is the output matrix.
3. Placing the Estimator-Error Poles: The error dynamics for the observer are:

e˙(t)=(A−LC)e(t)\dot{e}(t) = (A - LC)e(t)

where e(t)=x(t)−x^(t)e(t) = x(t) - \hat{x}(t) is the state estimation error.

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:

L = place(A', C', [-12+12j, -12-12j]);

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:

1. Observer Transient Response:

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

Why Does This Difference Exist?

• 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]);
𝑛𝑦𝑞𝑢𝑖𝑠𝑡(𝐻)

Output: Nyquist plot shown in Fig. 11.1

Figure: 11.1 Nyquist Diagram.

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)

4. Repeat TASK 4 for G(s)

11.6 Observation and Results


All questions should be answered precisely to get maximum credit. Lab report must
ensure following items:
Lab objectives
MATLAB codes
Results (graphs/tables) duly commented and discussed
Conclusion

11.7 Learning outcomes


67
1. Construct a transfer function from state space.
2. Construct a state-space from a transfer
function.
11.8 Exercise Questions
1. Design system shown in Fig. 11.3.

Figure: 11.3 Negative feedback system.

K
G(s) =
(s + 2)(s + 4)(s + 6)

a) Plot the Nyquist diagram.


b) Use your Nyquist diagram to find the range of gain, K, for stability.
c) Find the gain margin and the 180° frequency for the problem, if K =
100.

2. Using the Nyquist criterion, find the range of K for by designing the systems in
Fig. 11.4 and Fig. 11.5.

Figure: 11.4 Non-unity feedback system.

Figure: 11.5 Non-unity feedback system.

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

Magnetic Levitation System

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.

Figure: 12.1 Magnetic levitation system (Diagram).

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.

When current go through the winding, electromagnetic force F will be generated. By


controlling the current in the electromagnet winding to balance the steal ball gravity force
mg by magnetic force, the steal ball will be levitated in the air. Closed loop control is
required for the stability and anti-interference. The distance x from the steal ball to electric
magnet is detected by sensor system composed of light source and light sensor. To enhance
the performance, the speed of the distance variance can also be considered. The control
current is the input for magnetic levitation control object. The transfer function specified
below for Magnetic 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.

2. Open GML system root locus control interface.


3. (Enter MATLAB Simulink real time control toolbox “Googol Education
Products”, open “Root Locus Control Demo” in “Magnetic Levitation System\Root
Locus Experiments”).

Figure: 12.4 Googol magnetic levitation root locus control demo.

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.

Figure 12.5 Workspace sheet

11. Compare the experiment data with simulation result.


12. Users may also use other root locus methods for the controller design.

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

12.7 Learning Outcomes


At the end of this experiment student will learn
1. Use the root locus to design cascade compensators to improve the
steady-state error.
2. Use the root locus to design cascade compensators to improve the
transient response.
3. Use the root locus to design cascade compensators to improve both the
steadystate error and the transient response.

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.

Figure: 13.1 Inverted pendulum.


The transfer function specified below is for Inverted Pendulum System.

𝐺𝑐(𝑠) = 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.

Figure: 13.2 Procedure of open file (Root locus Control.mdl).

Figure: 13.3 Stage inverted pendulum (Root locus control).


3. Click on “ ”to start real-time workshop build procedures, and prompt
message will pop up in the MATLAB command window upon the completion of such
procedure (this procedures shall not repeat if no modification occurs to the control page
structure):

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.

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

13.7 Learning Outcomes


At the end of this experiment student will learn:
1 Use the root locus to design cascade compensators to improve the steady-state
error.
2 Use the root locus to design cascade compensators to improve the transient
response.
3 Use the root locus to design cascade compensators to improve both the steady-
state error and the transient response.
13.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.

77
Experiment No. 14

Design of an appropriate Controller using MATLAB


14.1 Objectives
To design an appropriate controller for different systems.

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

Plug these values into the transfer function


The goal of this problem is to show you how each 𝑜𝑓 𝐾𝑝,𝐾𝑖 𝑎𝑛𝑑 𝐾𝑑 contribute to
obtain:
• Fast rise time
• Minimum overshoot
• No steady-state error
Implement the designed controller in MATLAB and analyze the response of your
system before and after designing the controller. Attach MATLAB code and
results.

78
Mass-Spring-Damper Model

Figure: 15.1 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.

14.7 Observations and Results


All questions should be answered precisely to get maximum credit. Lab report must
ensure following items:
Lab objectives
MATLAB codes
Results (graphs/tables)
Conclusion

14.8 Learning Outcomes


At the end of this experiment student will learn
• To successfully design P, I, PD, PI, and PID controllers to meet closed-loop. •
Performance specifications including transient performance and steady-error.

14.9 Exercise Questions


1. Consider a process given below to be controlled by a PID controller,
400
Gp(s) =
s(s + 48.5)

a) Construct or plot the unit step response of Gp(s).


79
b) Try PI controllers with (𝐾𝑝 = 2, 10, 100), and 𝐾𝑖 = 𝐾𝑝/10. Investigate the
unit step response in each case, compare the results and comment.
c) Let 𝐾𝑝 = 100 , 𝐾𝑖 = 10 , and add a derivative term with (𝐾𝑑 = 0.1, 0.9, 2).
Investigate the unit step response in each case, compare the results and comment.
d) Based on your results in parts b) and c) above what do you conclude as a
suitable PID controller for this process? Give your justifications.

80
Experiment 15

DETERMINATION OF STEP & IMPULSE RESPONSE FOR A SECOND ORDER


UNITY FEEDBACK SYSTEM

OBJECTIVE: To determine I. Step response of 2nd order system


II. Impulse response of 2nd order system

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

You might also like