09 LQR
09 LQR
– p. 1/22
Consider the system
ẋ = Ax + Bu
– p. 2/22
Consider the system
ẋ = Ax + Bu
– p. 2/22
Consider the system
ẋ = Ax + Bu
– p. 2/22
Consider the system
ẋ = Ax + Bu
– p. 2/22
The matrix Q can be written as Q = M T M , where M is a
p × n matrix, with p ≤ n. With this representation
xT Qx = xT M T M x = z T z
– p. 3/22
The matrix Q can be written as Q = M T M , where M is a
p × n matrix, with p ≤ n. With this representation
xT Qx = xT M T M x = z T z
– p. 3/22
The matrix Q can be written as Q = M T M , where M is a
p × n matrix, with p ≤ n. With this representation
xT Qx = xT M T M x = z T z
– p. 3/22
Write J as
¯ f)
J = lim J(t
tf →∞
Z tf
¯ f) =
J(t [xT (t)Qx(t) + uT (t)Ru(t)] dt
0
– p. 4/22
Write J as
¯ f)
J = lim J(t
tf →∞
Z tf
¯ f) =
J(t [xT (t)Qx(t) + uT (t)Ru(t)] dt
0
¯ f ) is a monotonically increasing function of tf .
J(t
– p. 4/22
Write J as
¯ f)
J = lim J(t
tf →∞
Z tf
¯ f) =
J(t [xT (t)Qx(t) + uT (t)Ru(t)] dt
0
¯ f ) is a monotonically increasing function of tf . Hence,
J(t
as tf → ∞, J¯(tf ) either converges to a finite limit or
diverges to infinity
– p. 4/22
Write J as
¯ f)
J = lim J(t
tf →∞
Z tf
¯ f) =
J(t [xT (t)Qx(t) + uT (t)Ru(t)] dt
0
¯ f ) is a monotonically increasing function of tf . Hence,
J(t
as tf → ∞, J¯(tf ) either converges to a finite limit or
diverges to infinity
¯ f ) be finite?
Under what conditions will limtf →∞ J(t
– p. 4/22
Recall that (A, B) is stabilizable if the uncontrollable
eigenvalues of A, if any, have negative real parts
– p. 5/22
Recall that (A, B) is stabilizable if the uncontrollable
eigenvalues of A, if any, have negative real parts
– p. 5/22
Recall that (A, B) is stabilizable if the uncontrollable
eigenvalues of A, if any, have negative real parts
– p. 5/22
Recall that (A, B) is stabilizable if the uncontrollable
eigenvalues of A, if any, have negative real parts
– p. 5/22
Remarks:
– p. 6/22
Remarks:
1. The need for (A, B) to be stabilizable is clear, for
otherwise there would be no F such that
Re [λ(A + BF )] < 0
– p. 6/22
Remarks:
1. The need for (A, B) to be stabilizable is clear, for
otherwise there would be no F such that
Re [λ(A + BF )] < 0
2. To see why detectability of (A, M ) is needed, consider
Z ∞
ẋ = x + u, J = u2 (t) dt
0
– p. 6/22
Remarks:
1. The need for (A, B) to be stabilizable is clear, for
otherwise there would be no F such that
Re [λ(A + BF )] < 0
2. To see why detectability of (A, M ) is needed, consider
Z ∞
ẋ = x + u, J = u2 (t) dt
0
A = 1, B = 1, M = 0, R = 1
– p. 6/22
Remarks:
1. The need for (A, B) to be stabilizable is clear, for
otherwise there would be no F such that
Re [λ(A + BF )] < 0
2. To see why detectability of (A, M ) is needed, consider
Z ∞
ẋ = x + u, J = u2 (t) dt
0
A = 1, B = 1, M = 0, R = 1
(A, B) is controllable, but (A, M ) is not detectable
– p. 6/22
Remarks:
1. The need for (A, B) to be stabilizable is clear, for
otherwise there would be no F such that
Re [λ(A + BF )] < 0
2. To see why detectability of (A, M ) is needed, consider
Z ∞
ẋ = x + u, J = u2 (t) dt
0
A = 1, B = 1, M = 0, R = 1
(A, B) is controllable, but (A, M ) is not detectable
F = 0 ⇒ u(t) = 0 ⇒ J = 0
– p. 6/22
Remarks:
1. The need for (A, B) to be stabilizable is clear, for
otherwise there would be no F such that
Re [λ(A + BF )] < 0
2. To see why detectability of (A, M ) is needed, consider
Z ∞
ẋ = x + u, J = u2 (t) dt
0
A = 1, B = 1, M = 0, R = 1
(A, B) is controllable, but (A, M ) is not detectable
F = 0 ⇒ u(t) = 0 ⇒ J = 0
W (A + BF ) + (A + BF )T W + Q + F T RF = 0
– p. 7/22
Lemma 2: For any stabilizing control u(t) = F x(t), the
cost is given by
J = x(0)T W x(0)
where W is a symmetric positive semidefinite matrix that
satisfies the Lyapunov equation
W (A + BF ) + (A + BF )T W + Q + F T RF = 0
– p. 7/22
Theorem: Consider the system ẋ = Ax + Bu and the
performance index
Z ∞
J = [xT (t)Qx(t) + uT (t)Ru(t)] dt
0
0 = P A + AT P + Q − P BR−1 B T P
– p. 8/22
Remarks:
– p. 9/22
Remarks:
– p. 9/22
Remarks:
– p. 9/22
Remarks:
– p. 9/22
Example:
ẋ1 = x2 , ẋ2 = u
Z ∞
J = [x21 + ρu2 ] dt, ρ > 0
0
– p. 10/22
Example:
ẋ1 = x2 , ẋ2 = u
Z ∞
J = [x21 + ρu2 ] dt, ρ > 0
0
" # " # " #
0 1 0 1 0
A= , B= , Q= , R=ρ
0 0 1 0 0
– p. 10/22
Example:
ẋ1 = x2 , ẋ2 = u
Z ∞
J = [x21 + ρu2 ] dt, ρ > 0
0
" # " # " #
0 1 0 1 0
A= , B= , Q= , R=ρ
0 0 1 0 0
" #
1 h i h i
Q= 1 0 ⇒ M = 1 0
0
– p. 10/22
Example:
ẋ1 = x2 , ẋ2 = u
Z ∞
J = [x21 + ρu2 ] dt, ρ > 0
0
" # " # " #
0 1 0 1 0
A= , B= , Q= , R=ρ
0 0 1 0 0
" #
1 h i h i
Q= 1 0 ⇒ M = 1 0
0
" #
0 1
rank[B, AB] = rank = 2 ⇒ (A, B) is controllable
1 0
– p. 10/22
" # " #
M 1 0
rank = rank =2
MA 0 1
– p. 11/22
" # " #
M 1 0
rank = rank =2
MA 0 1
⇒ (A, M ) is observable
– p. 11/22
" # " #
M 1 0
rank = rank =2
MA 0 1
⇒ (A, M ) is observable
0 = P A + AT P + Q − P BR−1 B T P
– p. 11/22
" # " #
M 1 0
rank = rank =2
MA 0 1
⇒ (A, M ) is observable
0 = P A + AT P + Q − P BR−1 B T P
" # 0 = 1 − ρ1 p212
p11 p12
P = ⇒ 0 = p11 − ρ1 p12 p22
p12 p22
0 = 2p12 − ρ1 p222
– p. 11/22
" # " #
M 1 0
rank = rank =2
MA 0 1
⇒ (A, M ) is observable
0 = P A + AT P + Q − P BR−1 B T P
" # 0 = 1 − ρ1 p212
p11 p12
P = ⇒ 0 = p11 − ρ1 p12 p22
p12 p22
0 = 2p12 − ρ1 p222
√ p
p12 = ± ρ, p22 = 2ρ p12
– p. 11/22
" # " #
M 1 0
rank = rank =2
MA 0 1
⇒ (A, M ) is observable
0 = P A + AT P + Q − P BR−1 B T P
" # 0 = 1 − ρ1 p212
p11 p12
P = ⇒ 0 = p11 − ρ1 p12 p22
p12 p22
0 = 2p12 − ρ1 p222
√ p
p12 = ± ρ, p22 = 2ρ p12
√ √ 3/4 1 √
p12 = ρ, p22 = 2ρ , p11 = p12 p22 = 2ρ1/4
ρ
– p. 11/22
" √ #
2ρ1/4 ρ1/2
P = 1/2
√ 3/4
ρ 2ρ
– p. 12/22
" √ #
2ρ1/4 ρ1/2
P = 1/2
√ 3/4
ρ 2ρ
– p. 12/22
" √ #
2ρ1/4 ρ1/2
P = 1/2
√ 3/4
ρ 2ρ
– p. 12/22
" √ #
2ρ1/4 ρ1/2
P = 1/2
√ 3/4
ρ 2ρ
– p. 12/22
" √ #
2ρ1/4 ρ1/2
P = 1/2
√ 3/4
ρ 2ρ
−1/4 1
λ1,2 = ρ √ (−1 ± j)
2
– p. 12/22
Notice how F and the eigenvalues depend on ρ
– p. 13/22
Notice how F and the eigenvalues depend on ρ
h √ i
F = − ρ−1/2 2ρ−1/4
−1/4 1
λ1,2 = ρ √ (−1 ± j)
2
– p. 13/22
Notice how F and the eigenvalues depend on ρ
h √ i
F = − ρ−1/2 2ρ−1/4
−1/4 1
λ1,2 = ρ √ (−1 ± j)
2
What happens as you change ρ?
– p. 13/22
Matlab Calculations:
– p. 14/22
Matlab Calculations:
X = lyap(A,N) solves the Lyapunov equation
AX + XAT + N = 0
– p. 14/22
Matlab Calculations:
X = lyap(A,N) solves the Lyapunov equation
AX + XAT + N = 0
W (A + BF ) + (A + BF )T W + Q + F T RF = 0
– p. 14/22
X = are(A,S,Q) solves the Riccati equation
XA + AT X + Q − XSX = 0
S = BR−1 B T
– p. 15/22
X = are(A,S,Q) solves the Riccati equation
XA + AT X + Q − XSX = 0
S = BR−1 B T
P A + AT P + Q − P BR−1 B T P = 0
– p. 15/22
X = are(A,S,Q) solves the Riccati equation
XA + AT X + Q − XSX = 0
S = BR−1 B T
P A + AT P + Q − P BR−1 B T P = 0
– p. 15/22
LQR Design
– p. 16/22
LQR Design
– p. 16/22
Procedure:
– p. 17/22
Procedure:
1. Choose Q and R such that Q = M T M , with (A, M )
detectable, and R = RT > 0
– p. 17/22
Procedure:
1. Choose Q and R such that Q = M T M , with (A, M )
detectable, and R = RT > 0
2. Solve the Riccati equation
P A + AT P + Q − P BR−1 B T P = 0
– p. 17/22
Procedure:
1. Choose Q and R such that Q = M T M , with (A, M )
detectable, and R = RT > 0
2. Solve the Riccati equation
P A + AT P + Q − P BR−1 B T P = 0
– p. 17/22
Procedure:
1. Choose Q and R such that Q = M T M , with (A, M )
detectable, and R = RT > 0
2. Solve the Riccati equation
P A + AT P + Q − P BR−1 B T P = 0
– p. 17/22
Typical Choice:
q1 r1
q2 r2
Q= , R = ρ
... ...
qn rm
1 1
qi = , ri = , ρ>0
tsi (ximax )2 (uimax )2
tsi is the desired settling time of xi
ximax is a constraint on |xi |
uimax is a constraint on |ui |
ρ is chosen to tradeoff regulation versus control effort
– p. 18/22
Example:
0 1 0 0
A= 0 0 1 , B = 0
−0.4 −4.2 −2.1 1
– p. 19/22
Example:
0 1 0 0
A= 0 0 1 , B = 0
−0.4 −4.2 −2.1 1
– p. 19/22
Example:
0 1 0 0
A= 0 0 1 , B = 0
−0.4 −4.2 −2.1 1
R λ
0.01 −9.7364, −0.9039 ± 0.4593j
0.1 −0.6568, −1.9548 ± 1.0158j
1 −0.2599, −1.1433 ± 1.6840j
– p. 19/22
Q = diag(1,1,1)
2 1.5
R=0.01
R=0.1
R=1 1
1.5
0.5
x1
x2
1
0
0.5
−0.5
0 −1
0 1 2 3 4 5 0 1 2 3 4 5
1 5
0.5 0
0 −5
−0.5 −10
x3
u
−1 −15
−1.5 −20
−2 −25
−2.5 −30
0 1 2 3 4 5 0 0.2 0.4 0.6 0.8 1
– p. 20/22
R=0.1
1.5
Q11 = 1
1
Q11 = 10
1
0.5
x1
x2
0.5
0
0 −0.5
−1
−0.5
0 1 2 3 4 5 0 1 2 3 4 5
1 5
0 0
−5
−1
x3
u
−10
−2
−15
−3
−20
0 1 2 3 4 5 0 1 2 3 4 5
– p. 21/22
Q11=1;R=0.1
1.5 Q =10;R=0.1
11 1
Q11=10;R=0.4
1 0.5
x1
x2
0.5 0
−0.5
0
−1
−0.5
0 1 2 3 4 5 0 1 2 3 4 5
1 5
0 0
−5
−1
x3
−10
−2
−15
−3
−20
0 1 2 3 4 5 0 0.2 0.4 0.6 0.8 1
– p. 22/22