You are on page 1of 65

The University of Lahore, Lahore.

Control Systems Lab


Course Code: ECE4545

LAB # 1:
INTRODUCTION TO MATLAB

Name of student: …………………………………………………………………..

Roll No: …..………………………………………………………………………..

Date of LAB: ………………………………………………………………………

Report submitted on: ….……………………………………………….…………..

Section: ….……………………………………………….………………………..

Marks obtained: …………………………


OBJECTIVE:

To become familiar with the basic commands of Matlab.

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. Executing "help" gives a list of HELP topics, including the M-files in the
various libraries on disk. Typing "help topic" gives help on the
specified topic. If the topic is not in the help file, the help facility looks
on the disk for an M-file with the filename topic.m .

4. Follow the instructions in the PC-MATLAB PRIMER supplied to you to


gain familiarity with MATLAB.

5. The section entitled "Analysis and Simulation of Control Systems


using MATLAB" is to demonstrate the use of MATLAB in control
systems.

LAB TASKS:

1. Use the "help" command to get familiar with each of the following MATLAB
commands:

roots - poly - conv - polyval - pzmap - series - parallel -


feedback - impulse - step - plot - subplot - eig -
expm - bode - logspace - conj - imag - real - residue -
ss2tf - tf2ss-tf-zpk-tf2zp

a) Polynomials in‘s’ can be expressed as arrow vectors containing their coefficients.

b) A ‘poly ‘command is used to get a vector of a polynomial represented in factored form.


c) Polynomials can be multiplied by using ‘conv’ command.

d) The ‘roots’ command is used to find the roots of a polynomial.

e) A transfer function command ‘tf’ can be used to get transfer function expressed as
numerator polynomial divided by denominator polynomial.
2
𝐹𝐹(𝑠𝑠) =
(𝑠𝑠 + 8)(𝑠𝑠 + 4)

f) The command ′𝑭𝑭 = 𝒛𝒛𝒛𝒛𝒛𝒛([ ], 𝒃𝒃, 𝒂𝒂)′ is used to get transfer function expressed as
numerator polynomial divided by denominator polynomial in factored form.

g) The command ‘𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕𝒕’is used to get a transfer function if the numerator and denominator
are expressed in factored form.

h) The command polyval is use to calculate the value of polynomial of degree n evaluated
at particular variable used in polynomial.

i) The command series is used to connect systems in series.


j) The command parallel is used to connect systems in parallel.

k) The command feedback is used to get the closed loop system.

l) The command impulse is used to get impulse response of the system.

m) The command step is used to get the step response of the system.
n) The command bode is used to get the frequency response of the system.

o) The command pzmap is used to plot the pole zero map of the system.

p) The command eig is used to find the eigenvalues of the system

q) The command expm is used to get the exponential of the matrix.

r) The command plot is used for graphical representation.


s) The command real is used to get the real part of the system

t) The command imag is used to get the imaginary part of the system

u) The command conj is used to get the conjugate of the system

v) The command residue is used to convert a quotient of polynomial to pole residue


representation and back again.

w) The command tf2ss is used to convert transfer function to state space.


x) The command ss2tf is used to convert the state space to transfer function.

3) Consider the following polynomials.

P1= 10 s 3 + 15s 2 + 5s + 100


P 2 =( s + 1)( s + 2)( s + 3)( s + 4)

Find the roots of the following polynomials.

a) P=
3 P1 + P 2

b) P=
4 P1 − P 2

c) P5 = P1.P 2

C (s)
4) Find the overall transfer function = G1 ( s ).G2 ( s ) symbolically in both factored and
R( s)
polynomial forms by using Matlab. Also find its magnitude and phase in degree with s= 2 + j 4 .
G1 ( s ) G2 ( s )

2( s + 2)
R( s) ( s + 2)( s + 8) C (s)
s + 5s 2 + 10 s + 20
3

MATLAB code

Outputs
C (s)
5) Find the overall transfer function = G1 ( s ) + G2 ( s ) symbolically in both factored and
R( s)
polynomial forms by using Matlab. Also find its magnitude and phase in degree with s= 2 + j 4 .

𝑮𝑮𝟐𝟐 (𝒔𝒔)
MATLAB code

Outputs
Partial-Fraction Expansion:

b( s )
The partial-fraction for a transfer function F ( s ) = can be found using the
a( s)
[ r, p, k ] = residue ( b, a ) command. In this command ‘r’ is residue, ‘p’ is the roots of the
denominator and ‘k’ is direct quotient.

1) Find the Laplace Inverse of the following function by using partial fraction.

s3 + 2s 2 + 6s + 7
F ( s) =
s2 + s + 5

2) Find the Laplace Inverse of the above transfer function by using 𝒇𝒇 = 𝒊𝒊𝒊𝒊𝒊𝒊𝒊𝒊𝒊𝒊𝒊𝒊𝒊𝒊𝒊𝒊(𝑭𝑭(𝒔𝒔))

3) Compare the output obtain in step no.1 and 2.


To plot the pole and zero of a transfer, zplane( a , b ) command is used.
2
1) Given transfer 𝐹𝐹(𝑠𝑠) =
(𝑠𝑠+8)(𝑠𝑠+4)

a) Find the Laplace Inverse by using ‘residue’ command.

b) Find Laplace Inverse by using ‘ilaplace’ command then compare both the results.

c) Plot the pole zero plot and output plot in time domain.
The University of Lahore, Lahore.

Control Systems Lab


Course Code: ECE4547

LAB # 2:
INTRODUCTION TO MATLAB BASIC TOOL
(SIMULINK)
Name of student: …………………………………………………………………..

Roll No: …..………………………………………………………………………..

Date of LAB: ………………………………………………………………………

Report submitted on: ….……………………………………………….…………..

Section: ….……………………………………………….………………………..

Marks obtained: …………………………


INTRODUCTION TO SIMULINK AND SIMULATION

OBJECTIVES:

1. To become familiar with theSIMULINK.


2. To simulate a simple first-order speed control system using SIMULINK.
3. To learn how the disturbances in the control system are overcome.

INTRODUCTION:

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.

SIMULINK has two phases of use: model definition and model analysis. A typical session starts
by either defining a model or recalling a previously defined model, and then proceeds to analysis
of that model.

To facilitate model definition, SIMULINK adds a new class of windows called Block diagram
windows. In these windows, models are created and edited principally by mouse driven
commands. Part of mastering SIMULINK is to become familiar with the manipulation

After you define a model, you can analyze it either by choosing options from the SIMULINK
menus or by entering commands in MATLAB's command window.

Progress of simulation can be viewed while simulation is running.

Final results can be made available in MATLAB workspace when simulation is complete.

TUTORIAL:
To master SIMULINK, you must learn how to manipulate blocks and how to build models. You
must also become familiar with the types of blocks available.
Finally, you must learn how to use the analysis tools provided in SIMULINK. The construction
and simulation of a simple model, described in the following section, introduces you to each of
these concepts.

SIMULINK uses the metaphor of a block diagram to represent dynamic systems.


Defining a system is much like drawing a block diagram. Instead of drawing the individual
blocks, blocks are copied from libraries of blocks, either the standard block library supplied with
SIMULINK or block libraries you build yourself.

The standard block library is organized into several subsystems, grouping blocks according to
their behavior. Blocks can be copied from these or any other libraries or models into your model.

Example 1:
Generate the sinusoid 4sin(2t) and display it on the scope.

1. Double click on the on the MATLAB icon to display the MATLAB command window.

2. Open the SIMULINK block library by entering the command SIMULINK or by double
clicking on the SIMULINK icon .This command displays a new window containing icons
for the subsystem blocks that make up the standard library.

3. Open the sources subsystem by double clicking on the sources block, this displays
another window containing all blocks that produce output but have no input.

4. Select New from the File menu to open a new system window.

5. Drag the Signal Generator block from the Sources window to the new yet untitled,
window

6. Open the Signal Generator Block by double-clicking on its icon. This displays a dialog
box showing the controls for specifying the waveform, amplitude, and frequency of the
signal generated by the block.

7. Select the text box marked Frequency by positioning the cursor on it, set the frequency
to 1, and the Units to Hertz. Select the text box Amplitude and set the peak to 4. Click
on the OK button to close this window.

8. Open the Sinks library, and drag a copy of the Scope block to the new system window.

9. Open the Scope to see that its window is a graphic representation of an oscilloscope. Use
the pointer to select a suitable horizontal range. To set the Y-Axis Limits right-click on
an axes and choose Axes Properties.

10. The angle bracket (>) pointing out of the Signal Generator block's icon represents its
output port, and the angle bracket pointing into the Scope icon represents its input port.
To connect these two blocks, use the left mouse button to click on either the output or
input port of one block, drag to the other block's input or output port to draw a
connecting line, and then release the left mouse button. When the blocks are connected,
the angle brackets disappear, and a line with an arrowhead shows the direction of
the data flow.

11. Pull down the Simulation menu and choose Simulation Parameters.
12. A dialog box opens showing all the simulation parameters that can be modified.
Select the text box for the Maximum Step Size parameter, change the value to
0.01, and click on the OK button to close the simulation parameter dialog box.

13. Start the simulation by choosing Start from the Simulation menu. The Signal Generator
outputs the sinusoidal waveform for each time step and the Scope shows its input as the
trace of a sine wave.

14. The simulation stops when the stop-time in the Control Panel dialog box has been
reached, or by choosing Stop on the Simulation menu.

15. Choose Save from the File menu to display a dialog box in which you can specify the
filename and directory for this model.

Example 2:

Speed-Control System:

The speed control system is shown in basic form in fig.1. The system is composed of a dc motor
whose shaft speed is constant, a power amplifier that controls the motor voltage, a tachometer
coupled to the motor shaft and a circuit that detects the deviation or error between the reference
input and feedback signals. Fig. 2 is a block diagram representation of a system.

Fig.1 Speed Control System


Fig.2 Block diagram of Speed Control System

In analyzing the speed control of dc motor we will first find the transfer function of the system as
shown in Fig.3

Fig. 3 Schematic diagram of a dc motor

In control systems, a DC motor is a common actuator. The electric circuit and free body diagram
of the DC motor is shown in Fig 4.
Fig 4 circuit diagram of dc motor

The differential equations of the DC motor are:

Jθ •• + bθ • =
Ki
di
L + Ri =V − Kθ •
dt
Taking the Laplace transform of the differential equation transfer function of the DC motor can
be obtained
s( Js + b)θ (s) =
KI (s)
V − Ksθ (s)
( Ls + R) I (s) =
Eliminating I(s) we get transfer function of dc motor which is described as:

𝜃𝜃 𝐾𝐾𝑡𝑡 𝐾𝐾𝑚𝑚
= =
𝑉𝑉𝑎𝑎 𝑠𝑠(𝐽𝐽𝑚𝑚 + 𝑏𝑏)(𝐿𝐿𝑎𝑎 + 𝑅𝑅𝑎𝑎 ) + 𝐾𝐾𝑡𝑡 𝐾𝐾𝑒𝑒 𝑠𝑠(𝜏𝜏𝜏𝜏 + 1)
Where
𝐾𝐾𝑡𝑡
𝐾𝐾 =
𝑏𝑏𝑅𝑅𝑎𝑎 + 𝐾𝐾𝑡𝑡 𝐾𝐾𝑒𝑒
𝑅𝑅𝑎𝑎 𝐽𝐽𝑚𝑚
𝜏𝜏 =
𝑏𝑏𝑅𝑅𝑎𝑎 + 𝐾𝐾𝑡𝑡 𝐾𝐾𝑒𝑒
Thus the Transfer function between motor input and the output speed (𝑤𝑤𝑚𝑚 =𝜃𝜃̇)
becomes
𝑤𝑤𝑚𝑚 𝐾𝐾𝑚𝑚
=
𝑉𝑉𝑎𝑎 (𝜏𝜏𝜏𝜏 + 1)

For the purpose of simulation the following numerical values can be used:

𝐾𝐾(𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎 𝑔𝑔𝑔𝑔𝑔𝑔𝑔𝑔) 𝐾𝐾𝑚𝑚 𝜏𝜏 𝐾𝐾𝑓𝑓 (𝑡𝑡𝑡𝑡𝑡𝑡ℎ𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐)

15V/V 10 rad/sec/V 2.5 sec 12mV/rad/sec


The tachometer works essentially as a voltage generator, with the output voltage𝑉𝑉𝑠𝑠 proportional to
the magnitude of the angular velocity 𝑤𝑤𝑚𝑚 of the input shaft

Procedure:

1. Draw a block diagram for the system.


2. For the open-loop system 𝐾𝐾𝑓𝑓 = 0, obtain a plot of 𝑤𝑤𝑚𝑚 − 𝑡𝑡. Assume
𝑉𝑉𝑖𝑖 (t)=unit step.
3. Calculate the value of𝜏𝜏 from your graph and compare it with the theoretical value given.
4. How would your graph change if the inertia of the motor shaft Jis doubled?
5. For the closed-loop case (𝐾𝐾𝑓𝑓 = 12𝑚𝑚𝑚𝑚/𝑠𝑠𝑠𝑠𝑠𝑠), obtain a plot of 𝑤𝑤𝑚𝑚 − 𝑡𝑡.
6. Calculate the system time constant from your graph and compare it with the theoretical
value.
7. How would your graph change if the value 𝜏𝜏is doubled?
8. How would your graph change if the inertia of the motor shaft Jis doubled?
9. How would your graph change if the tachometer constant is doubled?

Notes on Simulation

A simulation can be started from either the command line or the Simulation menu. All of the
methods use the same arguments and menu parameters:

DC motor with disturbances:

Simulation from the Menu

1. A simulation can be run by selecting Start from the Simulation menu. Set the simulation
parameters in the Control Panel dialog box by selecting Simulation Parameters from the
Simulation menu.
2. The Control Panel dialog box has fields in which you can enter numbers or any legal
MATLAB expression, for example, the variables "Start time", Stop time", "Min step
size", and " Max step size", which can be defined in the MATLAB workspace.
3. The return variables [t, x, y] are used to put the time, state, and output trajectories into the
MATLAB workspace. The start and stop times for the simulation are set in the
variables tstart, and tfinal. The integration parameters minstep,maxstep, and final
control the relative local error, minimum step size, and maximum step size of the
simulation.

Simulation from the Command Line

1. To configure a simulation with identical parameters as those described by the Control


Panel dialog box, use the command
[T,X,Y] = SIM('model',TIMESPAN,OPTIONS,UT)
Where model in the name of the block diagram model
TIMESPAN is one of : Tfinal, [TStartTFinal], or [TStartOutputTimesTFinal].
Output Times are time points which will be returned in T, but in general T willinclude
additional time points.
OPTIONS: Optional simulation parameters. This is a structure created with SIMSET
using name value pairs
UT : Optional extern input.
Only the first parameter is required. All defaults will be taken from the block diagram,
including unspecified options. Any optional arguments specified will override the
settings in the block diagram.
2. All of the integration algorithms have identical calling syntax so that a different method
can be selected by simply changing the function name [euler, rk23, rk45, sim, adams,
gear].

Simulation Steps:
3. Open the SIMULINK block library by entering the commandsimulink
4. Open the Continuous subsystem by double-clicking on the Continuous block.
5. Select New from the File menu to open a new system window.
6. Build the block diagram of the system by dragging appropriate boxes.
7. Open the Sources subsystem by double-clicking on the Sources block. Drag the step
function block.
8. Start the simulation.
9. Output Trajectories from SIMULINK can be plotted using Scope blocks, or Return
variables and the MATLAB commands. For example:

Where the block labeled y is an output port taken from the Sinks list of blocks. Naming the
system tfout , [t, x, y] = sim('tfout' , 2) produces time histories, which can be plotted with plot(t,
y)

Report:

1. Obtain printouts of the SIMULINK block diagram of the speed-control system.

2. Attach plots of all time responses for all cases considered. Comment on all your results.
Disturbance Rejection in Cruise control system

1) The term Open loop-loop refers to the fact that there is no closed path or loop around
which the signals go in the block diagram. The open-loop output is given as

Y=10(u-0.5w)
𝑟𝑟
Y=10(10 – 0.5w) = r-5w;

The error in output is Error = r-y =5w


𝑤𝑤
The percent error is %error= 500*( 𝑟𝑟 )

2) The term Closed loop-loop refers to feedback system. Thus, the feedback has reduced the
sensitivity of the error to the grade by a factor 101 when compared with the open-loop
system. However, that there is now a small error on level ground, because even when
w=0,

Output=y=100r-100y-5w
Then;
100
Output=y= (101 )*r=0.99r
This error will be small as long as the loop gain (product of the plant and controller gains) is
large.
101
In case the error id too large, it is common practice to reset the reference, in this case to (100 ) r,
so the output reaches the true desired value.
The University of Lahore, Lahore.

Control Systems Lab


Course Code: ECE4545

LAB # 3:
MODELING IN SIMULINK

Name of student: …………………………………………………………………..

Roll No: …..………………………………………………………………………..

Date of LAB: ………………………………………………………………………

Report submitted on: ….……………………………………………….…………..

Section: ….……………………………………………….………………………..

Marks obtained: …………………………


Objectives:
1. Simulating a Cruise Control Model, Satellite Attitude Control Model, and Pendulum in
SIMULINK.
2. Modeling in SIMULINK of electrical and mechanical systems.

1) A Simple system; Cruise control Model

Friction (b𝑥𝑥̇ ) Mass (m)


Mass(m) u (velocity)

x (displacement)

𝑥𝑥̈ (Acceleration)

Write the equations of motion for the speed and forward motion of the car i.e.
u- b𝑥𝑥̇ =m𝑥𝑥̈
𝑏𝑏 𝑢𝑢
𝑥𝑥̈ +𝑚𝑚 𝑥𝑥̇ =𝑚𝑚
So, the transfer function will be,
1
𝑉𝑉(𝑠𝑠) 𝑚𝑚
= 𝑏𝑏
𝑈𝑈(𝑠𝑠) 𝑠𝑠+
𝑚𝑚

Implement this transfer function using SIMULINK and analyze its output. Use the values of m =
1580 kg, and b = 26 N.sec/m
Its output will be quite similar to a car whose driver accelerates it for instance and then leaves the
car to decelerate at its own speed.
Also make use of the differential equation to make a second model of the same system using
SIMULINK. Compare the output of both the systems now. It should be same.

Mass/kg Settling Time(Ts)/s Response(Fast/Slow)


M1=1400
M2=1580
M3=1700
2) Rotational Motion: Satellite Attitude Control Model

Satellites usually require attitude control so that antennas, sensors and solar panels are properly
oriented. Antennas are usually appointed toward a particular location on earth, while solar panels
need to be oriented toward the sun for maximum power generation.
The angle Ө that describes the satellite orientation must be measured with respect to an inertial
reference. The equation of motion becomes;
𝐹𝐹𝑐𝑐 d+𝑀𝑀𝐷𝐷 =I𝜃𝜃̈
The output of this system Ө, results from integrating the sum of the input torques twice; hence
this type of system is often referred to as the double-integrator plant. The transfer function can
be obtained as;
(↔)(𝑠𝑠) 1 1
=
𝑈𝑈(𝑠𝑠) 𝐼𝐼 𝑠𝑠 2
1
Where u=𝐹𝐹𝑐𝑐 d+𝑀𝑀𝐷𝐷 .In this form, the system is often referred to as the 𝑠𝑠 2 plant.

3) Rotational Motion: Pendulum

𝜃𝜃 Suspension point

Length(L)

Mass m

mgsin 𝜃𝜃
mg

Use MATLAB to determine the time history of Ө to a step input in 𝑇𝑇𝑐𝑐 of 1 N.m. Assume l=1m,
m=0.5 kg, and g=9.81 m/𝑠𝑠𝑠𝑠𝑠𝑠 2 .
The moment of inertia about the pivot point is I=m𝑙𝑙 2 . The sum of moments about the pivot point
contains a term from gravity as well as the applied torque 𝑇𝑇𝑐𝑐 . The equation of motion,
𝑇𝑇𝑐𝑐 -mglsin 𝜃𝜃=I𝜃𝜃̈
This is usually written in form of
𝑔𝑔 𝑇𝑇𝑐𝑐
𝜃𝜃̈ + sin 𝜃𝜃=
𝑙𝑙 𝑚𝑚 𝑙𝑙 2
Due to linearization the motion is small enough that sin 𝜃𝜃 ≅ 𝜃𝜃.
𝑔𝑔 𝑇𝑇𝑐𝑐
𝜃𝜃̈+ 𝜃𝜃=
𝑙𝑙 𝑚𝑚 𝑙𝑙 2
So the transfer function becomes
1
(↔)(𝑠𝑠) 𝑚𝑚 𝑙𝑙 2
= 𝑔𝑔
𝑇𝑇𝑐𝑐 (𝑠𝑠) 𝑠𝑠 2 + 𝑙𝑙
Once a control system is synthesized and shown to have desirable performance based on linear
analysis, it is then prudent to carry out further analysis are an accurate numerical simulation of a
system with all the nonlinearity in order to validate that performance.

Torque=1 N.m Settling Time(Ts)/s Response(Fast/Slow)


Length=1m
Mass/kg
M1=0.25
M2=0.50
M3=1.00

Mass=0.5kg Settling Time(Ts)/s Response(Fast/Slow)


Length=1m
Torque/Nm
T1=0.5
T2=1.0
T3=2.0

Torque=1 Nm Settling Time(Ts)/s Response(Fast/Slow)


Mass=0.5kg
Length/m
L1=0.5
L2=1.0
L3=2.0
Dynamic models of Electromechanical Systems

VL ( s )
1) Find the transfer function G ( s ) = of the following system using Mat-lab.
V (s)

MATLAB code:

X 2 (s)
2) Find the transfer function G ( s ) = of the following system using Mat-lab.
F (s)

MATLAB code:
θ 2 (s)
3) Find the transfer function G ( s ) = of the following system using Mat-lab.
T (s)

MATLAB code:

Lab Assignment no.1

1) Use MATLAB to find the response of the velocity of car as discussed in example 2.1.
2) Use MATLAB to determine the time history of motion for simple pendulum as discussed
in example 2.5.
The University of Lahore, Lahore.

Control Systems LAB


Course Code: ECE4545

LAB # 4:
Response of Dynamic System
Name of student: …………………………………………………………………..
Roll No: …..……………………………………………………………………….
Date of LAB: ………………………………………………………………………
Report submitted on: ….……………………………………………….…………..
Section: ….……………………………………………….………………………..

Marks obtained: …………………………


Objective:
To evaluate the effect of pole and zero location upon the time response of first- and second-order
systems.
Part A:
1. Given the transfer function
𝑎𝑎
𝐺𝐺(𝑠𝑠) =
𝑠𝑠 + 𝑎𝑎
a. Evaluate settling time and rise time for the following values of a: 1, 2, 3, 4.
Also, plot the poles.

2. Given the transfer function


𝑏𝑏
𝐺𝐺(𝑠𝑠) =
𝑠𝑠 2
+ 𝑎𝑎𝑎𝑎 + 𝑏𝑏
a. Evaluate percent overshoot, settling time, peak time, and rise time for the
following values: a=4; b=25. Also, plot the poles.
b. Calculate the values of a and b so that the imaginary part of the poles remains
the same but the real part is increased two times over that of Part A 2a, and
repeat P 2a.
c. Calculate the values of a and b so that the imaginary part of the poles remains
the same but the real part is decreased1/2 time over that of Part A 2a, and
repeat Part A 2a.
3.
a. For the system of Part A 2a, calculate the values of a and b so that the real
part of the poles remains the same but the imaginary part is increased two
times over that of Part A 2a, and repeat Part A 2a.
b. For the system of Part A 2a, calculate the values of a and b so that the real
part of the poles remains the same but the imaginary part is increased four
times over that of Part A 2a, and repeat Part A 2a.
4.
a. For the system of Part A 2a, calculate the values of a and b so that the
damping ratio remains the same but the natural frequency is increased two
times over that of Part A 2a, and repeat Part A 2a.
b. For the system of Part A 2a, calculate the values of a and b so that the
damping ratio remains the same but the natural frequency is increased four
times over that of Part A 2a, and repeat Part A 2a.
5. Briefly describe the effects on the time response as the poles are changed in each
of Part A 2, 3, and 4.

Part B:
1. Using Simulink, set up the systems of Part A 1 and plot the step response of each
of the four transfer functions on a single graph by using the Simulink LTI Viewer.
Also, record the values of settling time and rise time for each step response.
2. Using Simulink, set up the systems of Part A 2. Using the Simulink LTI Viewer,
plot the step response of each of the three transfer functions on a single graph.
Also, record the values of percent overshoot, settling time, peak time, and rise
time for each step response.
3. Using Simulink, set up the systems of Part A2a and Part A3 using the Simulink
LTI Viewer, plot the step response of each of the three transfer functions on a
single graph. Also, record the values of percent overshoot ,settling time, peak
time, and rise time for each step response.
4. Using Simulink, set up the systems of Part A2a and Part A4 using the
Simulink LTI Viewer, plot the step response of each of the three transfer
functions on a single graph. Also, record the values of percent overshoot, settling
time, peak time, and rise time for each step response

Part C:
1. For the first-order systems, make a table of calculated and experimental values of
settling time, rise time, and pole location.
2. For the second-order systems of Part A2, make a table of calculated and
experimental values of percent overshoot, settling time, peak time, rise time, and
pole location.
3. For the second-order systems of Part A 2a and Part A 3, make a table of calculated
and experimental values of percent overshoot, settling time, peak time, rise time,
and pole location.
4. For the second-order systems of Part A 2a and Part A 4, make a table of
calculated and experimental values of percent overshoot, settling time, peak time,
rise time, and pole location.
5. Discuss the effects of pole location upon the time response for both first- and
second-order systems. Discuss any discrepancies between your calculated and
experimental values.
Systems response with additional pole and zero

1. Evaluate the step response for percentage over shoot, rise, settling and peak time in
the following transfer function by adding a third pole at s = -100, -50 and -1
respectively if second order approximation is valid.

150
𝐺𝐺(𝑠𝑠) =
𝑠𝑠 2 + 20𝑠𝑠 + 150

Third pole Tp
Second Order Approximation %O.S Ts Tr
s=

-100

-50

-1

2. Evaluate the step response for percentage over shoot, rise, settling and peak time in
the following transfer function by adding a zero at s = -100, -50 and -1 respectively if
second order approximation is valid.

150
𝐺𝐺(𝑠𝑠) =
𝑠𝑠 2 + 20𝑠𝑠 + 150

Zero s = Second Order Approximation %O.S Ts Tr Tp

-100

-50

-1

3. Evaluate the step response for percentage over shoot, rise, settling and peak time in
the following transfer function by adding a pole at s = -3.5, -4.5,-3.9 and -4.01
respectively if second order approximation is valid.

150(𝑠𝑠 + 4)
𝐺𝐺(𝑠𝑠) =
𝑠𝑠 2 + 20𝑠𝑠 + 150
Pole s = Second Order Approximation %O.S Ts Tr Tp

-3.5

-4.5

-3.9

-4.01
The University of Lahore, Lahore.

Control Systems Lab


Course Code: ECE4545

LAB # 5:
Block Diagram Reduction & Time Specifications for
Closed loop Control Systems
Name of student: …………………………………………………………………..
Roll No: …..………………………………………………………………………..
Date of LAB: ………………………………………………………………………
Report submitted on: ….……………………………………………….…………..
Section: ….……………………………………………….………………………..

Marks obtained: …………………………


Objectives:
To verify the equivalency of the basic forms, including cascade, parallel, and
feedback forms. To verify the equivalency of the basic moves, including moving blocks past
summing junctions, and moving blocks past pickoff points.

The following three methods are available for block diagram reduction.
• Solution via series, parallel and feedback commands.
Series ( G1, G2 ) for cascade connection
Parallel ( G1, G2 ) for parallel connection
Feedback ( G, H sign) for feedback connection
• Solution Via Algebraic Operation
Ge ( s ) = G1 ( s ) * G2 ( s ) for cascade connection
G=e (s) G1 ( s ) + G2 ( s ) for parallel connection
G (s)
Ge ( s ) = for feedback connection
1 ± G (s) * H (s)
• Solution Via Append and Connect Commands
This topology may be used effectively for complicated system.

1) Find the equivalent transfer function using series command.

G1 ( s) G2 ( s)

2( s + 2)
R( s) ( s + 2)( s + 8) C (s)
s + 5s 2 + 10s + 20
3

2) Find the equivalent transfer function using parallel command.

G1 ( s )

( s + 10)( s + 100)
s 4 + s 3 + s 2 + 100

R( s) C (s)
G1 ( s )

2
s 3 + 1000 s + 2000
3) Find the equivalent transfer function using feedback command.

G1 ( s )

( s + 1)
R( s) C (s)
s ( s + 2)

G1 ( s )

( s + 3)
( s + 4)

4) Find the equivalent transfer of the following system.

Part A
𝟏𝟏
1. Find the equivalent transfer function of three cascaded block 𝐆𝐆𝐆𝐆(𝐬𝐬) = 𝐬𝐬+𝟏𝟏,
𝟏𝟏 𝐬𝐬+𝟑𝟑
𝐆𝐆𝐆𝐆(𝐬𝐬) = 𝐒𝐒+𝟒𝟒 , and 𝐆𝐆𝐆𝐆(𝐬𝐬) = 𝐬𝐬+𝟓𝟓.
2. Find the equivalent transfer function of three parallel blocks of G1, G2, and G3.

3. Find the equivalent transfer function of the negative


𝐬𝐬+𝟏𝟏
feedback system of H(s)Figure if 𝐆𝐆(𝐬𝐬) = 𝐒𝐒(𝐬𝐬+𝟐𝟐)and 𝐇𝐇(𝐬𝐬) =
𝐒𝐒+𝟑𝟑
.
𝐒𝐒+𝟒𝟒
4. For the system of Part A3, push H(s) to the left past the summing junction and draw the
equivalent system.

5. For the system of Part A3, push H(s) to the right past the pickoff point and draw the
equivalent system.

Part B
1. Using Simulink set up the cascade system of PartA1 and the equivalent single block.
Make separate plots of the step response of the cascaded system and its equivalent single
block. Record the values of settling time and rise time for each step response.
2. Using Simulink, setup the parallel system of Part A2andtheequivalentsingleblock. Make
separate plots of the step response of the parallel system and its equivalent single block.
Record the values of settling time and rise time for each step response.
3. Using Simulink set up the negative feedback system of PartA3 and the equivalent single
block. Make separate plots of the step response of the negative feedback system and its
equivalent single block. Record the values of settling time and rise time for each step
response.
4. Using Simulink, setup the negative feedback systems of Part A3, 4, and5.Make separate
plots of the step response of each of the systems. Record the values of settling time and
rise time for each step response.

PartC
1. Using your Part B data, verify the equivalent transfer function of blocks in cascade.
2. Using your Part B data, verify the equivalent transfer function of blocks in parallel.
3. Using your Part B data, verify the equivalent transfer function of negative feedback
systems.
4. Using your Part B data, verify the moving of blocks past summing junctions and pickoff
points.
5. Discuss your results. Were the equivalencies verified?

Part D
1. Given the block diagram from replaceG1, G2, G3, H1, H2, H3with the following transfer
functions and obtain an equivalent transfer function and draw figure in Simulink compare
the results.
2. Use Simulink to implement the block diagram from above figure using the transfer
functions given in the Part D1.

3. Verify your calculations from the Part D 1 with that of the equivalent transfer function
obtained with Simulink
The University of Lahore, Lahore.

Control Systems Lab


Course Code: ECE4545

LAB # 6:
Stability of a System
Name of student: …………………………………………………………………..
Roll No: …..………………………………………………………………………..
Date of LAB: ………………………………………………………………………
Report submitted on: ….……………………………………………….…………..
Section: ….……………………………………………….………………………..

Marks obtained: …………………………


Stability of the System
1. Determine the stability of the following system by plotting poles-zeros plot.

G (s)

1
R( s) s (2 s + 3s + 2 s 2 + 3s + 2)
4 3
C (s)

Poles-Zeros plot
2. Determine the value of ‘K’ that yield the close-loop response unstable, stable with
Overdamped, Underdamped and Undamped. Also plot the step response for each
value of ‘K’.

K
R( s) s ( s + 7)( s + 11) C (s)

System K

Unstable
Over damped

Under damped

Un damped

Step Responses
Lab Assignment no.4

3) Use MATLAB to plot transient response of the systems given in example no. 3.29 and
3.30 for a range of system’s gain if the systems remain stable.
The University of Lahore, Lahore.

Control Systems Lab


Course Code: ECE4545

LAB # 7:
STEADY STATE ERROR

Name of student: …………………………………………………………………..


Roll No: …..………………………………………………………………………..
Date of LAB: ………………………………………………………………………
Report submitted on: ….……………………………………………….…………..
Section: ….……………………………………………….………………………..

Marks obtained: …………………………


1) Determine the system types, static error constants and steady state errors with given
loops gains.

+
+ Controller Plant
R ∑ D ∑ G Y
+
-

+
+
∑ V

Figure No.1

Table No.1

500( s + 2)( s + 5)
G (s) =
( s + 8)( s + 10)( s + 12)
H(s)=1, Controller=1

System Type =

Inputs Static Error constants Steady state error

Step Kp = 1
e=
(∞ ) =
1+ K p
Ramp Kv = 1
e(∞=
) =
Kv
Parabolic Ka = 1
e(∞=
) =
Ka

Compare the above steady state errors by implementing Figure no.1 in SIMULINK and m
file for loop gain and input of table no.1.

Table No.2
500( s + 2)( s + 5)( s + 6)
G (s) =
s ( s + 8)( s + 10)( s + 12)
H(s)=1, Controller=1

System Type =

Inputs Static Error constants Steady state error

Step Kp = 1
e=
(∞ ) =
1+ K p
Ramp Kv = 1
e(∞=
) =
Kv
Parabolic Ka = 1
e(∞=
) =
Ka

Compare the above steady state errors by implementing Figure no.1 in SIMULINK and m
file for loop gain and input of table no.2.

Table No.3

500( s + 2)( s + 4)( s + 5)( s + 6)( s + 7)


G (s) =
s 2 ( s + 8)( s + 10)( s + 12)
H(s)=1, Controller=1

System Type =

Inputs Static Error constants Steady state error

Step Kp = 1
e=
(∞ ) =
1+ K p
Ramp Kv = 1
e(∞=
) =
Kv
Parabolic Ka = 1
e(∞=
) =
Ka

Compare the above steady state errors by implementing Figure no.1 in SIMULINK and m file
for loop gain and input of table no.3
2) Find the value of K in the following control system by using MATLAB if steady
error is 10%.

K ( s + 5)
R( s) G (s) = C (s)
s ( s + 6)( s + 7)( s + 8)

MATLAB code:
Electric-Motor Position Control Problem:

+
1
+ 𝑘𝑘𝑝𝑝
R ∑ ∑ 𝑠𝑠(𝜏𝜏𝜏𝜏 + 1) Y
- +

+
1+𝑘𝑘𝑡𝑡 𝑠𝑠 +
∑ V

Figure No.2

3) Consider an electric motor position control problem, including a non unity feedback
system caused by having tachometer fixed to the motor shaft and its voltage is fed
back as part of the control. Equivalent feedback block diagram is shown in the
above figure
Let 𝒌𝒌𝒑𝒑 = 𝟖𝟖 𝑽𝑽/𝑽𝑽 ,τ= 2 sec and 𝒌𝒌𝒕𝒕 = 𝟎𝟎. 𝟖𝟖
Determine the system types, static error constants and steady state errors with
respect to reference input
Table No.4

1
G(s)= H(s)= 1+𝑘𝑘𝑡𝑡 𝑠𝑠D=𝑘𝑘𝑝𝑝
𝑠𝑠(𝜏𝜏𝜏𝜏+1)

System Type =

Inputs Static Error constants Steady state error

Step Kp = 1
e=
(∞ ) =
1+ K p
Ramp Kv = 1
e(∞=
) =
Kv
Parabolic K a = e(∞=)
1
=
Ka
Compare the above steady state errors by implementing Figure No.2 in SIMULINK and m file
for loop gain and input of table no.4
The University of Lahore, Lahore.

Control Systems Lab


Course Code: ECE4545

LAB # 8:
STATE SPACE REPRESENTATION

Name of student: …………………………………………………………………..


Roll No: …..………………………………………………………………………..
Date of LAB: ………………………………………………………………………
Report submitted on: ….……………………………………………….…………..
Section: ….……………………………………………….………………………..

Marks obtained: …………………………


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
ss - conversion to state-space
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 states-space (tf2ss):


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

[A, B, C, D] = tf2ss(num, den)


Convert the following transfer function into state space by hand and using m file
𝒔𝒔
𝑯𝑯(𝒔𝒔) =
(𝒔𝒔 + 𝟏𝟏)(𝒔𝒔𝟐𝟐 + 𝟒𝟒𝒔𝒔 + 𝟏𝟏𝟏𝟏)
State-space to transfer function (ss2tf):
To obtain the transfer function from state-space equations, use the following MATLAB code

[num, den] = ss2tf(A, B, C, D)


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

𝑥𝑥1̇ 0 1 0 𝑥𝑥1 0
𝑥𝑥̇
� 2� = � 0 0 𝑥𝑥
1 � � 2 � + � 25 �u
𝑥𝑥̇ 3 −5 −25 −5 𝑥𝑥3 −120
𝑥𝑥1
y=[1 0 0]�𝑥𝑥2 �
𝑥𝑥3

.
Example: Consider a spring-mass system in the figure below:

The differential equation of this system is 𝒎𝒎𝒙𝒙̈ +b𝒙𝒙̇ + 𝒌𝒌𝒌𝒌 = 𝑭𝑭


Obtain the state-space representation of the above system by hand and then obtain its
transfer function using ss2tf command in MATLAB
Controller and observer canonical form:
MATLAB can also be used to convert state-space representations to parallel form or controller
canonical form using the command
canon(A,B,C,D, ‘type’) where type = modal, yields parallel form
type = companion, yields controller canonical form.
Obtain the controller and observer canonical forms of the forms of the mass-spring system
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
Cruise control Model

Friction (b𝑥𝑥̇ ) Mass (m)


Mass(m) u (velocity)

x (displacement)

𝑥𝑥̈ (Acceleration)

Write the equations of motion for the speed and forward motion of the car i.e.
u- b𝑥𝑥̇ =m𝑥𝑥̈

Rewrite the equation of motion in state variable form, where the output is the car position
x. Obtain its controller and observer canonical forms. Find the observability and
controllability matrices and state whether the above system is observable/controllable or
both?
The University of Lahore, Lahore.

Control Systems Lab


Course Code: ECE4545

LAB # 9:
Designing Controller and Observer in MATLAB
Name of student: …………………………………………………………………..
Roll No: …..………………………………………………………………………..
Date of LAB: ………………………………………………………………………
Report submitted on: ….……………………………………………….…………..
Section: ….……………………………………………….………………………..

Marks obtained: …………………………


Objective:To simulate a system that has been designed for transient response via a
state-space controller and observer
Steps:
(i) Make a m file to calculate the controller gains from the system matrix (F) using the command
K=acker(F,G,poles)
(ii) Include L=acker(F’,H’,poles)’ in your m file to find the observer gains. Check the
controllability and observability of the system by finding the ranks of controllability and
observability matrices respectively. Run your m file
(iii) In SIMULINK design a controller and import the parameters from the workspace

Cruise Control system

1) Given the plant of cruise control system


𝟏𝟏
𝑽𝑽(𝒔𝒔) 𝒎𝒎
= 𝒃𝒃
𝑼𝑼(𝒔𝒔) 𝒔𝒔+𝒎𝒎
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
2) Design an estimator for the simple pendulum. Compute the estimator gain matrix
that will place both the estimator error poles at -10wo. Verify the result using
MATLAB for wo=1. Evaluate the performance of the estimator
3) Consider a system with the transfer function
𝟗𝟗
𝑮𝑮(𝒔𝒔) = 𝟐𝟐
𝒔𝒔 − 𝟗𝟗
(a) Find (Fo,Go,Ho) for this system in observer canonical form.
(b) Is (Fo,Go) controllable?
(c) Compute K so that the closed-loop poles are assigned to s=-3±3j
(d) Is the closed-loop system of part(c) observable?
(e) Design a full-order estimator with estimator-error poles at s=-12±12j
(f) Suppose the system is modified to have a zeroL
𝟗𝟗(𝒔𝒔 + 𝟏𝟏)
𝑮𝑮𝟏𝟏 = 𝟐𝟐
𝒔𝒔 − 𝟗𝟗
Prove that if u=-Kx+r, there is a feedback gain K that makes the closed-loop system
unobservable
The University of Lahore, Lahore.

Control Systems Lab


Course Code: ECE4545

LAB # 10:
Root Locus
Name of student: …………………………………………………………………..
Roll No: …..………………………………………………………………………..
Date of LAB: ………………………………………………………………………
Report submitted on: ….……………………………………………….…………..
Section: ….……………………………………………….………………………..

Marks obtained: …………………………


1. Find the loop gain and poles position by plotting the root locus of the following
system.

1
R( s) G (s) = C (s)
s 2 + 10s + 1

Figure No.1
Table No.1

K Pole 1 Pole 2 K Pole 1 Pole 2


2. Plot the root locus of the following system. Also find the loop gain at point
√𝟐𝟐
𝒔𝒔 = −𝟐𝟐 + 𝒋𝒋( 𝟐𝟐 )
How can you verify if this point is on the root locus in MATLAB?

( s + 3)( s + 4)
R( s) G ( s) = C (s)
( s + 1)( s + 2)

Figure No.2
3. Plot the root locus of the following system. Find break away point, the exact point
and gain where root locus crosses the 0.45 damping line and jω axis crossing. Also
find the range within which the system is stable.

K ( s 2 − 4 s + 20)
R( s) G (s) = C (s)
( s + 4)( s + 2)

Figure No.3
Range of K for system stability Z line crossing jω Crossing Breakaway point
4. Design the K in the following system to yield 1.52% over shoot. Also estimate the
settling time, peak time and steady state error if second order approximation is
valid.

K ( s + 1.5)
R( s) G (s) = C (s)
s ( s + 1)( s + 10)

Figure No.4
Close Loop Third
Case Close Loop Poles 𝑻𝑻𝒔𝒔 𝑻𝑻𝒑𝒑 𝑲𝑲𝒗𝒗
Gain C.L.P
The University of Lahore, Lahore.

Control Systems Lab


Course Code: ECE4545

LAB # 11:
Lead-Lag Compensation
Name of student: …………………………………………………………………..
Roll No: …..………………………………………………………………………..
Date of LAB: ………………………………………………………………………
Report submitted on: ….……………………………………………….…………..
Section: ….……………………………………………….………………………..

Marks obtained: …………………………


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

1) An elementary magnetic suspension is depicted in the figure below. For small


motions near the reference position, the voltage e on the photodetector is related to
the ball displacement y (in meters) by e=100y. The upward force (in newtons) on the
ball caused by current i (in amperes) may be approximated by f=0.5i+20y. The mass
of the ball is 20 g, and the gravitational force is 9.8N/kg. The power amplifier is
voltage-to-current device with an output (in amperes) of i=u+V0

a) Write the equations of motion of this setup.


b) Give the value of the bias V0 that results in the ball being in equilibrium at y=0.
c) What is the transfer function from u to e?
d) Suppose that the control input u is given by u=-Ke. Sketch the root locus of the
closed-loop system as a function of K.
𝑼𝑼 𝒔𝒔+𝒛𝒛
e) Assume that a lead compensation is available in the form 𝑬𝑬 = 𝑫𝑫(𝒔𝒔) = 𝑲𝑲 𝒔𝒔+𝒑𝒑. Give
values of K, z, and p that yield improved performance over the one proposed in part
(d)
2) Consider the rocket-positioning system shown in the figure below
a) Show that if the sensor that measure x has a unity transfer function, the lead
compensator
𝒔𝒔+𝟐𝟐
H(s) = 𝑲𝑲 𝒔𝒔+𝟒𝟒
Stabilizes the system.

b) Assume that the sensor transfer function is modeled by a single pole with a 0.1 sec time
constant and unity DC gain. Using the root-locus procedure, find a value for the gain K
that will provide the maximum damping ratio
Fc + F
1
∑ x
- 𝑠𝑠 2

𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆

H(s)

You might also like