Optimal Control
Optimal Control
f T
=x Px (6)
t t
f f x
Substitute for , ,
t x t
from (6), (5), (1) into (4) to get
P
T min T T T
x x = u x Qx + u Ru + 2x P (Ax + Bu) (7)
t
To minimize the RHS of (7) w.r.t. u, take the partial
derivative
x Qx + u Ru + 2x P (Ax + Bu) = 2uT R + 2xT P B
T T T
u
(8)
Equate it to zero to get
u = R1 B T P x (9)
xT P x = xT (Q + 2P A P BR1 B T P )x (10)
xT P x = xT (Q + P A + AT P P BR1 B T P )x
and
P = (Q + P A + AT P P BR1 B T P ) (11)
P A + AT P + Q P BR1 B T P = 0 (12)
Summary
Set u as in (9)
P (A BR1 B T P ) + (A BR1 B T P )T P
+ Q + P BR1 B T P = 0
where
2 0
Q= , R=1
0 3
and we get
3.1633 0.3166
P =
0.3166 0.7628
1 T
K = Kopt = R B P = 0.3166 0.7628
(A BK) = 1.3814 j1.1867
x , K=K
1 opt
x , K=K
2 2 opt
x , K=K
1 1
x , K=K
2 1
4
0 1 2 3 4 5 6 7 8 9 10
The states x
6
K=K
opt
8 K=K
1
10
12
14
0 1 2 3 4 5 6 7 8 9 10
The input u
30
25
K=K
opt
20 K=K1
15
10
0
0 1 2 3 4 5 6 7 8 9 10
u = R1 B T P x R1 B T s (18)
s = (A BR1 B T P )T s Qr (19)
P = P A AT P Q + P BR1 B T P (20)
Let x = and define r to be the reference for x. Find
the optimal control V (for infinite horizon) such that the
following cost function is minimized:
Z
T 2 1 0
J= (r x) Q(r x) + V dt, Q =
0 0 5
0.8
0.6
0.4
0.2
0.2
0.4
0.6
0.8
0 5 10 15 20 25 30 35 40 45 50
Input voltage
0.6
0.4
0.2
0.2
0.4
0.6
0 5 10 15 20 25 30 35 40 45 50
Cost function J
160
140
120
100
80
60
40
20
0
0 5 10 15 20 25 30 35 40 45 50
0.8
0.6
0.4
0.2
0.2
0.4
0.6
0.8
0 5 10 15 20 25 30 35 40 45 50
Input voltage
2.5
1.5
0.5
0.5
1.5
2.5
0 5 10 15 20 25 30 35 40 45 50