Laboratory
Report
Inverted
Pendulum
Experiments
Control
Systems
Laboratory
Submitted
by
Ankit
Kumar
Department
of
Aerospace
Engineering
Indian
Institute
of
Technology
Bombay
August
23,
2026
Contents
1
System
Identication
2
2
Pole
Placement
State
Feedback
Control
5
3
Balancing
the
Pendulum
Using
PD
Control
11
1
Chapter
1
System
Identication
Objective
The
objective
of
the
experiment
is
to
perform
system
identication
by
de-
termining
the
moment
of
inertia
of
a
pendulum
system.
This
involves
both
analytical
and
experimental
methods
to
nd
the
moment
of
inertia
acting
about
the
pendulum
pivot,
using
the
QUBE-Servo
2
pendulum
system
as
a
model.
Procedure
1.
Displace
the
pendulum
slightly
from
equilibrium.
2.
Allow
it
to
oscillate
freely.
3.
Measure
the
time
for
several
oscillation
cycles.
4.
Compute
the
frequency
f
.
5.
Calculate
the
moment
of
inertia
J
p
.
Theory
From
the
free-body
diagram
in
Figure
1.1,
the
resulting
nonlinear
equation
of
motion
of
the
pendulum
is
J
p
¨
α
(
t
)
=
m
p
gl
sin(
α
(
t
))
,
(1.1)
2
Courtesy:
QUANSER
Figure
1.1:
Free
body
diagram
of
pendulum.
where
J
p
is
the
moment
of
inertia
of
the
pendulum
at
the
pivot
axis,
m
p
is
the
mass
of
the
pendulum,
L
p
is
the
length
of
the
pendulum
(from
pivot
to
end),
and
l
=
L
p
2
is
the
distance
between
the
pivot
and
center
of
mass.
The
moment
of
inertia
of
the
pendulum
can
be
found
experimentally.
As-
suming
the
pendulum
is
not
actuated,
linearizing
Equation
(1.1)
and
solving
for
the
dierential
equation
yields
J
p
=
m
p
gl
(2
πf
)
2
,
(1.2)
where
f
is
the
measured
frequency
of
the
pendulum
as
the
arm
remains
rigid.
The
frequency
is
calculated
using
f
=
n
cyc
∆
t
,
(1.3)
where
n
cyc
is
the
number
of
cycles,
and
∆
t
is
the
duration
of
these
cycles.
Alternatively,
it
J
p
can
be
calculated
using
the
moment
of
inertia
expression,
J
=
r
2
dm,
(1.4)
where
r
is
the
perpendicular
distance
between
the
element
mass
dm
and
the
axis
of
rotation.
3
Simulation
results
The
pendulum
is
displaced
slightly
from
its
equilibrium
position
and
allowed
to
oscillate
freely.
The
free
oscillation
response
of
the
pendulum
is
shown
in
Fig.
1.2.
60
65
70
75
80
Time (sec)
-3
-2
-1
0
1
2
3
Figure
1.2:
Free
oscillation
of
pendulum
stick.
Observation
The
experimental
value
of
the
moment
of
inertia
is
found
to
be
in
close
agreement
with
the
theoretical
value.
The
small
discrepancy
between
the
two
values
can
be
attributed
to
damping,
friction,
and
measurement
errors
during
the
experiment.
4
Chapter
2
Pole
Placement
State
Feedback
Control
Objective
The
objective
is
to
verify
the
controllability
of
the
inverted
pendulum
and
design
and
implement
a
pole
placement-based
state-feedback
controller
for
balancing
the
system.
Procedure
1.
Check
the
controllability
of
the
system.
2.
Select
the
desired
closed-loop
pole
locations.
3.
Compute
the
state-feedback
gain
matrix
K
.
4.
Implement
the
designed
controller
in
Simulink.
5.
Run
the
experiment
and
record
the
system
response.
Theory
The
standard
state-space
representation
of
a
multi-input
multi-output
(MIMO)
continuous
linear-time
invariant
(LTI)
system
with
n
state
variables,
r
input
variables,
and
m
output
variables
is
˙
x
(
t
)
=
Ax
+
Bu
(2.1)
5
and
y
(
t
)
=
Cx
(
t
)
+
Du
(
t
)
(2.2)
where
x
∈
R
n
×
1
is
the
vector
of
state
variables,
u
∈
R
r
×
1
is
the
control
input
vector,
y
∈
R
m
×
1
is
the
output
vector,
A
∈
R
n
×
n
is
the
system
matrix,
B
∈
R
n
×
r
is
the
input
matrix,
C
∈
R
m
×
n
is
the
output
matrix,
and
D
∈
R
m
×
r
is
the
feedforward
matrix.
The
state-feedback
control
of
a
system
is
shown
in
Figure
2.1.
Let
u
be
a
state
feedback
control
law
of
the
form
u
=
−
Kx
(2.3)
where
K
∈
R
m
×
n
is
the
feedback
gain.
Applying
this
to
Equation
(1.1)
gives
the
closed-loop
system
˙
x
=
Ax
−
BKx
=
(
A
−
BK
)
x.
(2.4)
Figure
2.1:
State
feedback
control
The
state
vector
x
of
the
rotary
pendulum
system
is
dened
x
=
θ
α
˙
θ
˙
α
T
.
(2.5)
The
reference
signal
includes
the
desired
rotary
arm
position,
θ
r
and
is
dened
x
ref
=
θ
r
0
0
0
T
(2.6)
and
the
control
strategy
used
to
balance
the
pendulum
(and
track
the
rotary
arm
setpoint)
is
u
=
K
(
x
ref
−
x
)
=
k
p,θ
(
θ
r
−
θ
)
−
k
p,α
α
−
k
d,θ
˙
θ
−
k
d,α
˙
α.
(2.7)
6
Controllability
If
the
system
is
unstable,
we
may
be
able
to
design
a
state-feedback
con-
troller
to
stabilize
it.
These
objectives
are
achievable
only
if
the
system
is
controllable.
To
check
whether
the
system
is
controllable,
we
compute
the
rank
of
the
controllability
matrix:
C
=
B
AB
A
2
B
·
·
·
A
n
−
1
B
,
(2.8)
where
n
is
the
dimension
of
the
state
vector
x
.
The
linear
system
described
above,
or
equivalently
the
pair
(
A,
B
),
is
said
to
be
controllable
if
and
only
if
rank(
C
)
=
n.
(2.9)
Otherwise,
we
conclude
that
the
system
is
uncontrollable.
Pole
Placement
If
(
A,
B
)
is
controllable,
we
can
use
state
feedback
to
place
the
poles
at
desired
locations,
for
example
in
the
left-half
of
the
s
-plane.
Thus,
we
can
nd
a
gain
matrix
K
for
the
closed-loop
system
to
obtain
a
desired
characteristic
equation.
The
desired
characteristic
equation
for
an
n
th-order
system
can
be
written
as
s
n
+
a
n
−
1
s
n
−
1
+
·
·
·
+
a
1
s
+
a
0
=
0
,
(2.10)
where
a
i
∈
R
,
i
∈
{
0
,
1
,
.
.
.
,
n
−
1
}
.
(2.11)
To
illustrate
how
to
design
K
to
obtain
desired
pole
locations,
consider
the
following
example.
Let
A
=
0
1
0
0
0
1
3
−
1
−
5
,
B
=
0
0
1
.
(2.12)
The
characteristic
equation
of
the
open-loop
system
is
|
sI
−
A
|
=
s
3
+
5
s
2
+
s
−
3
=
0
.
(2.13)
The
open-loop
poles
are
located
at
{−
4
.
64
,
−
1
,
0
.
65
}
,
(2.14)
7
therefore,
the
system
is
unstable.
To
obtain
the
closed-loop
poles
{−
1
,
−
2
,
−
3
}
,
(2.15)
the
desired
characteristic
equation
is
(
s
+
1)(
s
+
2)(
s
+
3)
=
s
3
+
6
s
2
+
11
s
+
6
.
(2.16)
Applying
the
state-feedback
control
u
=
−
Kx,
(2.17)
with
the
gain
matrix
K
=
k
1
k
2
k
3
,
(2.18)
the
closed-loop
system
becomes
A
−
BK
=
0
1
0
0
0
1
3
−
k
1
−
1
−
k
2
−
5
−
k
3
.
(2.19)
The
characteristic
equation
of
A
−
BK
is
s
3
+
(
k
3
+
5)
s
2
+
(
k
2
+
1)
s
+
(
k
1
−
3)
.
(2.20)
Equating
the
coecients
of
Eq.
(2.20)
with
those
of
the
desired
polyno-
mial
in
Eq.
(2.16),
we
obtain
k
1
−
3
=
6
,
(2.21)
k
2
+
1
=
11
,
(2.22)
k
3
+
5
=
6
.
(2.23)
Solving
for
the
gains
gives
K
=
9
10
1
.
(2.24)
Thus,
the
gain
matrix
K
moves
the
poles
to
their
desired
locations.
Time-Domain
Specications
The
rotary
inverted
pendulum
system
has
four
poles.
However,
if
two
of
the
closed-loop
poles
are
chosen
to
be
closer
to
the
imaginary
axis
(typically
by
a
factor
equal
to
or
greater
than
four)
than
the
remaining
poles,
the
conjugate
poles
are
considered
to
be
dominant
and
the
system’s
behavior
can
be
approximated
by
a
second-order
system.
8
Poles
p
1
and
p
2
are
the
complex
conjugate
dominant
poles
and
are
chosen
to
satisfy
the
natural
frequency
ω
n
and
damping
ratio
ζ
specications.
The
conjugate
poles
are
given
by
p
1
=
−
σ
+
jω
d
,
(2.25)
p
2
=
−
σ
−
jω
d
,
(2.26)
where
σ
=
ζω
n
,
(2.27)
and
ω
d
=
ω
n
1
−
ζ
2
,
(2.28)
is
the
damped
natural
frequency.
The
remaining
closed-loop
poles
p
3
and
p
4
are
placed
along
the
real
axis
to
the
left
of
the
dominant
poles.
The
desired
damping
ratio
and
natural
frequency
for
the
system
are
selected
as
ζ
=
0
.
65
,
ω
n
=
4
.
(2.29)
Using
the
selected
damping
ratio
and
natural
frequency,
the
desired
dom-
inant
poles
are
determined
and
the
remaining
poles
are
placed
suciently
farther
into
the
left
half
of
the
(s)-plane.
The
corresponding
state-feedback
gain
matrix
is
then
calculated
using
the
pole-placement
method.
The
de-
signed
controller
is
implemented
in
the
system
model,
and
its
performance
is
evaluated
based
on
pendulum
stabilization,
rotary-arm
position
tracking,
and
control
eort.
The
resulting
responses
are
presented
in
the
following
section.
Simulation
results
As
shown
in
Fig.
2.2a,
the
pendulum
angle
remains
close
to
the
upright
equi-
librium
position,
indicating
successful
stabilization
by
the
pole
placement
controller.
As
shown
in
Fig.
2.2b,
the
rotary
arm
tracks
the
desired
posi-
tion
with
a
noticeable
transient
response.
As
shown
in
Fig.
Fig.
2.2c,
the
control
voltage
remains
bounded,
with
short-duration
peaks
during
transient
changes.
Observation
The
pole-placement
controller
provides
improved
transient
performance
and
enables
direct
assignment
of
the
desired
closed-loop
pole
locations.
9
70
72
74
76
78
Time (sec)
-6
-4
-2
0
2
4
6
(a)
Variation
in
pendulum
angle.
70
72
74
76
78
Time (sec)
-60
-40
-20
0
20
40
(b)
Variation
in
rotary
arm
angle.
70
72
74
76
78
Time (sec)
-6
-4
-2
0
2
4
6
(c)
Variation
in
voltage.
Figure
2.2:
Performance
of
pole
placement
controller.
10
Chapter
3
Balancing
the
Pendulum
Using
PD
Control
Objective
The
aim
of
this
experiment
is
to
implement
a
PD
control
strategy
to
balance
the
rotary
pendulum
system.
Procedure
1.
Implement
the
PD
controller
in
Simulink.
2.
Set
the
controller
gains:
k
p,θ
=
−
2
,
k
p,α
=
30
,
k
d,θ
=
−
2
,
k
d,α
=
2
.
5
.
3.
Run
the
QUARC
controller.
4.
Bring
the
pendulum
to
the
upright
position
manually.
5.
Record
the
system
responses.
Theory
The
rotary
pendulum
system,
or
the
Furuta
Pendulum,
is
a
classic
system
often
used
to
teach
modeling
and
control
in
physics
and
engineering.
The
rotary
arm,
which
is
attached
to
the
motor
pivot,
is
denoted
by
the
variable
θ
and
the
pendulum
angle,
attached
to
the
end
of
the
rotary
arm,
is
denoted
by
α
.
Note
the
following
conventions:
11
Figure
3.1:
Block
diagram
of
balance
PD
control
for
rotary
pendulum
Angle
α
is
dened
as
the
inverted
pendulum
angle,
i.e.,
the
angle
with
respect
to
the
upright
vertical
position
where
α
=
0
means
the
pendu-
lum
is
perfectly
upright.
It
is
expressed
mathematically
using
α
=
α
full
mod
2
π
−
π,
Where
α
full
is
the
pendulum
angle
measured
by
the
encoder,
i.e.,
the
continuous
angle
measurement
is
dened
as
zero
when
the
pendulum
is
in
the
downward
conguration.
Both
angles
are
dened
as
positive
when
rotated
in
the
counterclock-
wise
(CCW)
direction.
When
a
positive
voltage
is
applied
to
the
motor,
the
rotary
arm
moves
in
the
positive
CCW
direction.
In
this
experiment,
we
will
nd
control
strategies
that
balance
the
pendulum
in
the
upright
position
while
maintaining
a
desired
position
of
the
arm.
When
balancing
the
system,
the
pendulum
angle
α
is
small,
and
balancing
can
be
accomplished
with
a
simple
PD
controller,
as
shown
in
Fig.
3.1.
If
we
are
further
interested
in
keeping
the
arm
in
a
desired
position,
a
feedback
loop
from
the
arm
position
will
also
be
introduced.
The
control
law
can
then
be
expressed
as:
u
=
k
p,θ
(
θ
r
−
θ
)
−
k
p,α
α
−
k
d,θ
˙
θ
−
k
d,α
˙
α
(3.1)
where
k
p,θ
is
the
arm
angle
proportional
gain,
k
p,α
is
the
pendulum
angle
pro-
portional
gain,
k
d,θ
is
the
arm
angle
derivative
gain,
and
k
d,α
is
the
pendulum
angle
derivative
gain.
The
desired,
or
reference,
angle
of
the
rotary
arm
is
denoted
by
θ
r
.
The
reference
for
the
pendulum
angle
is
zero
(i.e.,
upright
12
position).
The
balance
control
is
to
be
enabled
when
the
pendulum
is
within
the
following
range:
|
α
|
≤
10
◦
.
(3.2)
Given
that
the
pendulum
starts
in
the
downward
vertical
position,
it
needs
to
be
manually
brought
up
to
its
upright
vertical
position.
Once
the
pendulum
is
within
±
10
◦
,
the
balance
controller
is
engaged.
It
remains
in
balance
mode
until
the
pendulum
goes
beyond
±
10
◦
.
If
desired,
you
can
integrate
this
with
an
algorithm
that
swings
up
the
pendulum
automatically.
Simulation
results
As
shown
in
Fig.
3.2a,
the
pendulum
angle
remains
within
a
small
range
around
the
upright
position,
indicating
successful
balancing
using
the
PD
controller.
As
shown
in
Fig.
3.2b,
the
rotary
arm
shows
a
noticeable
de-
viation
from
the
desired
position,
indicating
comparatively
limited
position
regulation,
which
may
be
attributed
to
the
wear
and
tear
of
the
instrument.
As
shown
in
Fig.
3.2c,
the
control
voltage
uctuates
within
a
bounded
range
while
maintaining
the
pendulum
in
the
balanced
state.
Observation
The
PD
controller
successfully
maintains
the
pendulum
near
the
upright
equilibrium,
but
provides
comparatively
limited
control
over
the
rotary-arm
position
and
transient
response.
Conclusion
The
inverted
pendulum
system
was
successfully
modeled
and
experimen-
tally
analyzed.
System
identication
showed
good
agreement
between
the
theoretical
and
experimental
moment
of
inertia
values.
The
pole-placement
controller
successfully
stabilized
the
pendulum,
provided
improved
transient
performance,
and
enabled
the
rotary
arm
to
track
the
desired
angular
posi-
tion.
The
PD
controller
also
maintained
the
pendulum
in
the
upright
posi-
tion,
although
with
comparatively
limited
transient
and
position
regulation.
Overall,
both
controllers
demonstrated
eective
stabilization
of
the
inverted
pendulum
system.
13
120
122
124
126
128
130
132
Time (sec)
-1.2
-1
-0.8
-0.6
-0.4
-0.2
0
(a)
Variation
in
pendulum
angle.
120
122
124
126
128
130
132
Time (sec)
-14
-12
-10
-8
-6
-4
-2
0
(b)
Variation
in
rotary
arm
angle.
120
122
124
126
128
130
132
Time (sec)
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
(c)
Variation
in
voltage.
Figure
3.2:
Performance
of
PD
controller.
14