Optimal Control
Optimal Control
Chapter 4 101
Daniel Abebe Modern Control Systems Lecture Note
Chapter 4 102
Daniel Abebe Modern Control Systems Lecture Note
The open loop system dynamics combined with minimum state observer dy-
namics is
..
ẋ1 0 1 0 . 0 0 x 0
1
..
ẋ2 0 0 1 . 0 0 x2 1
..
ẋ3 −4 −4 −1
. 0 0 x3 0
= + u
. . . . . . . . . . . . . . . . . . . . . . . . . . .
..
0 −28 .
ω̇1 0 17 16 ω1 0
..
ω̇2 0 0 49 . −25 −25 ω2 1
h i
Since matrix B is not changed Kf = 12 12 5 , the closed loop dynamics of
the system with reduced order observer is
η̇ A − B1 Kf S1 A12 − B1 Kf S2 0 B1 Kf S2 η
1 11 1
η̇2 A21 − B2 Kf S1 A22 − B2 Kf S2
0 B2 Kf S2 η2
= (4.43)
˙
η̃1 0 0 0 0 η̃1
η̃˙ 2 0 0 0 A22 − Lc A12 η̃2
h iT
Let S1 = 1 1 1 , with this
A11 − B1 Kf S1 = −30
T
1 1 1
Let S2 = we have,
1 1 1
h i
A12 − B1 Kf S2 = −33 −33
h i
B1 Kf S2 = 29 29
0
A21 − B2 Kf S1 =
−1
1 0
A22 − B2 Kf S2 =
0 0
0 0
B2 Kf S2 =
0 0
Chapter 4 103
Daniel Abebe Modern Control Systems Lecture Note
17 16
A22 − Lc A12 =
−25 −25
Chapter 4 104
Daniel Abebe Modern Control Systems Lecture Note
Implying that
0 1 h 0
i
A22 = A11 = 0 A12 = 1 0
A21 =
−11 −6 −6
1 h i
B1 = 0 B2 = C1 = 1 C2 = 0 0
−3
So J = A22 − LA12 is the error dynamics matrix which need to be stabilized.
s −1 l h i
+ 1 1 0 = s2 + 4s + 8
11 s + 6 l2
s + l1 −1
= s2 + 4s + 8
11 + l2 s + 6
s2 + (6 + l1 )s + 6l1 + l2 + 11 = s2 + 4s + 8
6 + l1 = 4 ⇒ l1 = −2 6l1 + l2 + 11 = 8 ⇒ l2 = 9
−2 2 1
L= ⇒ J =
9 −20 −6
Chapter 4 105
Daniel Abebe Modern Control Systems Lecture Note
Finally
0 13 13
N = A21 + JLc + Lc A11 = + =
−6 4 −2
1
M = B2 − Lc B1 =
−3
The open loop dynamics of the system combined with reduced order state
observer dynamics is
..
ẋ1 0 1 0 . 0 0 x 0
1
..
ẋ2 0 0 1 . 0 0 x2 1
..
ẋ3 −6 −11 −6 . 0 x3 −3
0
= + u
. . . . . . . . . . . . . . . . . . . . . . . . . . .
..
−2 1 ω1 1
ω̇1 13 0 0 .
..
ω̇2 −2 0 0 . −20 −6 ω2 −3
Chapter 4 106
Daniel Abebe Modern Control Systems Lecture Note
Solution
As shown in chapter 2 on example 2 the system has one unobservable mode.
So we cannot design an observer for unobservable mode of the system, but
can design for the observable modes of the system. As we can see from the
output matrix of the decomposed system one state can be directly measured
while one cannot. Thus we design a state observer of order 1. The dynamics
look of the observable mode of the system is
..
2 . 1 1
ẋ = . . . . . . . . . x + . . . u
..
−4 . 0 1
.
h i
y = 1 .. 0 x
s − A22 + lA12 = s + 1
s − 0 + l = s + 1 ⇒ l = 1 ⇒ Lc = 1
J = A22 − lA12 = 0 − 1 = −1
N = A21 + JLc + Lc A11 = −4 − 1 + 2 = −3
M = B2 − Lc B1 = 1 − 1 = 0
ω̇ = −ω − 3x1
The open loop system state equation combined with reduced order state ob-
server equation is
..
ẋ1 2 1 . 0 x 1
1
..
ẋ2 −4 0
. 0 x2 1
= + u
. . . . . . . . . . . . . . . . . . . . .
..
ω̇ −3 0 . 1 ω 0
Chapter 4 107
Daniel Abebe Modern Control Systems Lecture Note
4.7 Exercises
1. Consider a system
0.16 2.16 −1 h i
ẋ = x+ u y= 1 1 x
−0.16 −1.16 1
2. Design a full state observer for IPC dynamics on 1.3.4 that has poles at
−1, −1, −1 ± i. use any valid parameter.
3. Design a full state observer for dc motor dynamics having poles at −1 ± 2i.
Use any valid parameters.
5. Design a reduced state observer for IPC dynamics on 1.3.4, where the position
of the cart and position of the pendulum is directly measured and the angular
velocity of the pendulum and linear velocity of the cart is not. The poles of
the observer are at−1 ± 2i.
6. Design a Kalman-Bucy filter for IPC dynamics and DC motor dynamics. Use
any valid parameters.
Chapter 4 108
Daniel Abebe Modern Control Systems Lecture Note
9. Design a full state observer having poles at −1, −1±2i, for a system described
by
0 3 0 2
h i
ẋ = 0 2 1 x + 1 u y = 0 2 1 x
1 1 0 −1
13. For examples 6 and 7 determine the closed loop dynamics of the system with
full state feedback using reduced order state observer, if the feedback gain Kf
required to place the closed loop poles of the system at s = −1, s = −1 ± 1i
Chapter 4 109
Chapter 5
Optimal control deals with the most celebrated problem of modern control theory,
”determination of best control strategy, selecting optimum control strategy, select-
ing optimum control vector u, that minimize cost function or performance index”.
Consider an LTI system with initial condition x0 :
ẋ = Ax + Bu
y = Cx + Du (5.1)
The objective of optimal control is to determine the control vector u that forces
the behavior of the dynamic system at the required final state by maximizing the
required cost function and at the same time fulfills the physical constraints.
The cost function has a general representation of:
Z tf
t=tf
J = θ[x(t), t] |t=t0 + φ(x(t), u(t), t)dt (5.2)
t0
t=t
The first term θ[x(t), t] |t=t0f
is called terminal error optimization problem (Termi-
Z tf
nal cost function) and the second term φ(x(t), u(t), t)dt is called optimal cost
t0
function over the entire trajectory (the function to be optimized over the entire
trajectory).
110
Daniel Abebe Modern Control Systems Lecture Note
Chapter 5 111
Daniel Abebe Modern Control Systems Lecture Note
∆f depends both on t and ∆t, hence it is written as ∆f (t, ∆t). In similar way for
a functional J(x(t), t) the incremental of a functional is defined as:
δx(t) is called variation of the function x(t). Since the increment of a functional
depends on x(t) and δx(t) it is written as J((x(t), δx(t)).
1 d2 f
df
∆f = ∆t + ∆t2 + . . . − f (t∗ ) (5.12)
dt t∗ 2! dt2 t∗
neglecting higher order terms in ∆t,
∗ df
∆f = f (t ) + ∆t − f (t∗ )
dt t∗
∆f = f˙(t∗ )∆t = df (5.13)
∂J 1 ∂ 2J 2
∆J = δx + δx + . . . − J(x(t)) (5.14)
∂x 2! ∂x2
∂J 1 ∂ 2J
is called first variation and is called second variation of a functional.
∂x 2! ∂x2
neglecting higher order terms in δx,
∂J
∆J = δx (5.15)
∂x
Chapter 5 112
Daniel Abebe Modern Control Systems Lecture Note
Similar conditions hold for functional to have optimum value, the necessary con-
dition is that it’s first variation must vanish (δJ = 0) and sufficient condition is
δ 2 J < 0 for local maximum and δ 2 J > 0 for local minimum.
A functional maybe a function of one or more functions, like function of several vari-
able V (x, y, z), in similar manner we have functional which can be J(x(t), y(t), z(t)).
The only difference is in function the variable x, y and z are independent variables
while in functional they are a function of another independent variable.
In control system we deal with functional of the form
Consider a functional φ(x, ẋ) if we take δx and δ ẋ as deviation from x and ẋ respec-
tively, and if we define our cost function as
Z tf
J(x, ẋ) = φ(x, ẋ)dt (5.18)
t0
Chapter 5 113
Daniel Abebe Modern Control Systems Lecture Note
∂ 2φ
2
d ∂ φ ∂ 2φ
− ≥ 0 and ≥0
∂x2 dt ∂x∂ ẋ ∂ ẋ2
for local minimum and
∂ 2φ ∂ 2φ ∂ 2φ
d
2
− ≤ 0 and ≤0
∂x dt ∂x∂ ẋ ∂ ẋ2
for local maximum.
With regard to boundary condition there are four cases:
1. x is fixed at t0 and fixed at tf (fixed end trajectory). This means x(t0 ) = C1
and x(tf ) = C2 where C1 and C2 are constants. Then there is no restriction
∂φ
posed on since δx = 0 for both t = t0 and t = tf .
∂ ẋ
∂φ
2. x is fixed at t0 and free at tf . This means x(t0 ) = C1 and = 0 for t = tf
∂ ẋ
∂φ
since we don’t know about δx at tf . Then there is no restriction posed on
∂ ẋ
for t = t0 .
∂φ
3. x is fixed at tf and free at t0 . This means x(tf ) = C2 and = 0 for t = t0
∂ ẋ
∂φ
since we don’t know about δx at t0 . Then there is no restriction posed on
∂ ẋ
for t = tf .
∂φ
4. x is free at tf and free at t0 . This means = 0 for both t = t0 and t = tf
∂ ẋ
since we don’t know about δx at t0 and tf .
Chapter 5 114
Daniel Abebe Modern Control Systems Lecture Note
subjected to
ẋ = Ax + Bu (5.25)
Let us define general function which include the constraint and the function to be
optimized as
Chapter 5 115
Daniel Abebe Modern Control Systems Lecture Note
Matrix Q is a weighing matrix for state error and R is a weighing matrix for input.
The Choice depended on the optimization problem and design specifications. If
state error is required to be minimized matrix Q should be high and if input to
the system is required to be minimized more than the state tracking error matrix
R should be high. In state feedback controller design penalizing input is same as
penalizing state, since the control signal is linear combination of the state of the
system.
The possible starting of guessing the values of the matrices can be one of the following
• Diagonal weights
q 0 0 0
1
0 q2 0 0
Q=
0 0 q3 0
0 0 0 q4
1
Choose each qi = , where x̃i is the tolerable error of each state of the system.
x̃2i
• Output weighting
Let z = Hx be the output you want to keep small. Assume (A, H) observable.
Use Q = xT x, R = ρI ⇒ trade off z 2 vs ρu2 .
Where H = xT Qx + uT Ru + λT and λ(t) = P (t)x(t)
Most of the time Q = C T C and the weight of the matrix is adjusted based on the
performance requirement of the system.
Chapter 5 116
Daniel Abebe Modern Control Systems Lecture Note
Replacing for Kf in equation 5.38 result in Riccati equation in which we solve for
matrix P .
Q + P A + AT P − P BR−1 B T P = 0 (5.41)
given that (A, B) is stabilizable, the other method of finding solution for linear
d
quadratic optimal regulator is by letting xT (Q + KfT RKf )x = − (xT P x) after
dt
replacing for u in equation 5.9 and final state xf = 0 (same control objective bring
the system to zero final state). which result in
xT (Q + KfT RKf )x = −ẋT P x − xT P ẋ
xT (Q + KfT RKf )x = −xT (AT − KfT B T )P x − xT P (A − BKf )x
AT P − KfT B T P + P A − P BKf = −(Q + KfT RKf ) (5.42)
Chapter 5 117
Daniel Abebe Modern Control Systems Lecture Note
(B T P )T + P B − (RKf )T + KfT R = 0
Kf = R−1 B T P (5.43)
So the control signal that minimize the optimal quadratic regulator function is
ẋ = Ax + Bu ⇒ ẋ = (A − BKf )x
xd + u + x y
- B ʃ C
+
Kf
Figure 5.1: Block diagram representation of LTI system with optimal state feedback
controller
Chapter 5 118
Daniel Abebe Modern Control Systems Lecture Note
ẋ = Ax + Bu
y = Cx + Du (5.45)
at this point the rate of change of the states variables will be zero and the output is
expected to be equal to the reference values. Hence for a pair (xd ,ud ) equation 5.45
will be
Axd + Bxd = 0
r = Cxd + Dud (5.46)
(5.47)
−A B −x 0
d = (5.48)
−C D ud r
• Case-I: When the number of inputs m, is strictly smaller than the number
of controlled outputs p, we have an under-actuated system. In this case, the
system of equation 5.48 generally does not have a solution because it presents
more equations than unknowns.
1
Rosenbrock’s matrix is obtained by regarding the controller output as the only output of the
system.
Chapter 5 119
Daniel Abebe Modern Control Systems Lecture Note
Also in this case, s = 0 should not be an invariant zero of the system because
otherwise P (0) cannot be full rank.
The optimal set-point problem can be reduced to that of optimal regulation by
considering an auxiliary system with state x̃ = x − xd , ũ = u − ud whose dynamics
are:
x̃˙ = A(x − xd ) + B(u − ud )
x̃˙ = Ax̃ + B ũ (5.52)
We can then regard equation 5.49 and equation 5.52 as an optimal regulation prob-
lem for which the optimal solution is given by:
ũ = −Kf x̃ (5.53)
Going back to the original input and state variables u and x, we conclude that the
optimal control for the set-point problem defined by equation 5.45 and equation 5.49
is given by
u = −Kf (x − xd ) + ud (5.54)
Since the solution to equation 5.48 can be written in form
xd = F r (5.55)
ud = N r (5.56)
The values of F and N are determined using equation 5.46, by replacing for xeq = F r
and xd = N r:
Axd + Bud = 0 ⇒ AF r + BN r = 0 ⇒ (AF + BN ) = 0 (5.57)
Cxd + Dud = r ⇒ CF r + DN r = r ⇒ (CF + DN ) = I (5.58)
Solving for F from equation 5.57 and replacing in equation 5.58, the values for
matrices N and F is:
N = (D − CA−1 B)−1 (5.59)
F = −A−1 B(D − CA−1 B)−1 (5.60)
Chapter 5 120
Daniel Abebe Modern Control Systems Lecture Note
ud
N
r xd + u + x y
F + -
Kf + B ʃ C
+
u = −Kf x + Ko r (5.61)
as time goes to infinity (t → ∞) the state x, goes to the desired state xd and the
input u, tends toward desired input ud , having dynamic equation:
since ẋd is zero at t → ∞, then the dynamic equation 5.63, can be written as
Form equation 5.68, by replacing for ud and xd ,the value of matrix Ko is:
In cases where the states of the dynamic system are not directly accessible, a state
observer can be utilized to estimate the state of the system, thereby allowing the
use of the estimated state for control purposes.
Chapter 5 121
Daniel Abebe Modern Control Systems Lecture Note
r u + x y
Ko
+ B ʃ C
- +
Kf
The LQR approach is a widely used method for designing state feedback controllers.
It involves minimizing a quadratic cost function that captures the system’s perfor-
mance and control effort. The optimal state feedback controller gain matrix is
obtained by solving the associated algebraic Riccati equation. Once the controller
gain matrix is obtained, it can be used to stabilize the system and achieve desired
performance.
On the other hand, the problem of designing an optimal state estimator gain matrix
involves minimizing a similar quadratic cost function that captures the difference
between the actual state and the estimated state. The optimal estimator gain ma-
trix is obtained by solving another algebraic Riccati equation. Once the estimator
gain matrix is obtained, it can be used to estimate the system’s state accurately.
The duality property between these two problems arises because the same cost func-
tion is used in both cases, but with different weighting matrices. In other words, the
solution to one problem can be used to solve the other problem by simply swapping
the weighting matrices.
ẋ = Ax + Bu
y = Cx + Du (5.70)
where x is the state vector, u is the control input, y is the output, and A, B, C, and
D are matrices that describe the system’s dynamics.
Chapter 5 122
Daniel Abebe Modern Control Systems Lecture Note
To design an optimal state feedback controller gain matrix using LQR, we first define
the cost function as follows:
Z tf
J= ((x̂ − x)T Q(x̂ − x) + uT Ru) dt (5.71)
t0
where Q and R are weighting matrices that capture the relative importance of the
state and control effort, respectively. The optimal controller gain matrix Kf is
obtained by solving the following algebraic Riccati equation:
Q + P A + AT P − P BR−1 B T P = 0 (5.72)
To design an optimal state estimator gain matrix using LQR, we define a similar
cost function as follows:
Z tf
J= ((x̂ − x)T Q(x̂ − x) + (y T Ry y)) dt (5.73)
t0
where Q and Ry are weighting matrices that capture the relative importance of the
output and state estimation error, respectively. The optimal estimator gain matrix
Lc is obtained by solving the following algebraic Riccati equation:
Q + P A + AT P − P C T Ry−1 CP = 0 (5.74)
The duality property between the two problems arises from the fact that they share
the same mathematical structure. Specifically, the state feedback controller gain
matrix design problem can be formulated as a quadratic optimization problem us-
ing the linear quadratic regulator (LQR) technique. Similarly, the state estimator
gain matrix design problem can be formulated as a quadratic optimization problem
using the linear quadratic estimator (LQE) technique.
The LQR and LQE techniques are based on minimizing a cost function that mea-
sures the deviation of the system’s states from a desired trajectory and the deviation
of the estimated states from the actual states, respectively. The cost function is for-
mulated as a quadratic function of the system’s states and inputs, and its coefficients
are determined by the system’s dynamics and performance specifications.
The duality property between the two problems implies that the optimal gain ma-
trices obtained from the LQR and LQE techniques are related to each other. Specif-
ically, the optimal state feedback controller gain matrix is equal to the transpose of
the optimal state estimator gain matrix, up to a scaling factor. This means that if
we solve the state feedback controller gain matrix design problem using LQR, we
can obtain the optimal state estimator gain matrix by transposing the solution and
scaling it appropriately.
Chapter 5 123
Daniel Abebe Modern Control Systems Lecture Note
5.6 Examples
1. Determine the incremental of the following functional
Z tf
J= (2x2 (t) + 1)dt (5.75)
t0
Solution
Solution
∂J
δJ = δx(t)
Z∂xtf
∂
= (4x(t)δx(t) + 2(δx(t))2 )δx(t) dt
t ∂x
Z 0tf
= (4δx(t) + 4δx(t))δx(t) dt
t0
Z tf
= 8(δx(t))2 dt
t0
π
with boundary condition x(0) = 0, x( ) = 1
2
Solution:
From the cost function we know that φ(x, ẋ) = x2 − ẋ2 , from Euler Lagrangian
equations
∂φ d ∂φ
− =0
∂x dt ∂ ẋ
Chapter 5 124
Daniel Abebe Modern Control Systems Lecture Note
ẍ + x = 0
λ2 + λ = 0 ⇒ λ1 = −i, λ2 = i
x = C1 eλ1 t + C2 eλ2 t
= C1 e−it + C2 eit
= (C1 + C2 ) cos t + i(C2 − C1 ) sin t
x(t) = sin(t)
subjected to
0 1 0
ẋ = x +
0 0 1
with initial and final states x(0) = [1 1]T and x(1) = [0 0]T .
Chapter 5 125
Daniel Abebe Modern Control Systems Lecture Note
Solution:
1
From constrained optimization we know that φ(x, ẋ, u) = u2 +λT (Ax+Bu−
2
ẋ). The control law we determine should minimize
Z 1
1 2
J= u + λ1 (x2 − ẋ1 ) + λ2 (u − ẋ2 ) dt
0 2
Using the Euler Lagrangian equations
∂φ d ∂φ
− = 0 ⇒ 0 + λ̇1 = 0 ⇒ λ̇1 = 0
∂x1 dt ∂ ẋ1
∂φ d ∂φ
− = 0 ⇒ x2 − ẋ1 = 0 ⇒ ẋ1 = x2
∂λ1 dt ∂ λ̇1
result in state equation.
∂φ d ∂φ
− = 0 ⇒ λ1 + λ̇2 = 0 ⇒ λ̇2 = −λ1
∂x2 dt ∂ ẋ2
∂φ d ∂φ
− = 0 ⇒ u − ẋ2 = 0 ⇒ ẋ2 = u
∂λ2 dt ∂ λ̇2
result in state equation.
∂φ d ∂φ
− = 0 ⇒ u − λ2 = 0 ⇒ λ2 = −u
∂u dt ∂ u̇
λ̇1 = 0 ⇒ λ1 = C1 ,
λ̇2 = −λ1 ⇒ λ2 = −C1 t + C2
u(t) = −λ2 ⇒ u(t) = C1 t + C2
solving this equations C1 = 18 and C2 = 10. Hence the control law that
optimize the constrained cost function is
u(t) = 18t − 10
Chapter 5 126