0% found this document useful (0 votes)
29 views11 pages

CPC L10 LQR

The document discusses the linear quadratic regulator (LQR) problem and its solution using dynamic programming. It presents the LQR formulation, describes how dynamic programming can be used to solve LQR problems by working backwards in time, and provides a MATLAB algorithm to calculate the optimal feedback gain K at each time step to minimize a quadratic cost function over time.

Uploaded by

pepe sanchez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views11 pages

CPC L10 LQR

The document discusses the linear quadratic regulator (LQR) problem and its solution using dynamic programming. It presents the LQR formulation, describes how dynamic programming can be used to solve LQR problems by working backwards in time, and provides a MATLAB algorithm to calculate the optimal feedback gain K at each time step to minimize a quadratic cost function over time.

Uploaded by

pepe sanchez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Linear quadratic regulator

Eduardo F. Camacho

Outline

◼ LQR formulation
◼ Dynamic programing
◼ LQR solution
◼ Steady-state
◼ Infinite horizon

◼ C

2
LQR formulation

Objective function

4
Multiobjective and Pareto front

for i=1:10000
x=rand(1);
y=rand(1)
J1(i)=x*x+3*(y-1)*(y-1);
J2(i)=4*(x-2)*x+y*y;
end

Multiobjective and Pareto front

6
Dynamic Programming

• Dynamic programming (DP) is ideally suited


for sequential decision problems.
• DP is a mathematical technique well suited for
the optimization of multistage decision
problems.
• Developed by Richard Bellman in the early
1950’s.
• Applications :
• Reservoir operation, water allocation,
capacity expansion, irrigation scheduling,
water quality control, shortest route
problems etc.
7

Dynamic Programming

• Bellman’s principle of optimality:


• “Given the current state of system, the
optimal policy (sequence of decisions) for
the remaining stages is independent of the
policy adopted in the previous stages”.
• Given an optimal sequence of decisions or
choices, each subsequence must also be
optimal..

8
Dynamic Programming: shortest path

Dynamic Programming: shortest path

2, 6,
A D

7,E

4, 3, 10,H (I)
A D

6,F

2, 7,
A D

10
LQR solved by dynamic programming

11

LQR solved by dynamic programming II

12
LQR solved by dynamic programming III

13

LQR algorithm

14
LQR algorithm matlab

for t=N:-1:1
P=Q+A'*Pt1*A-A'*Pt1*B*inv(R+B'*Pt1*B)*B'*Pt1*A;
c1(:,t)=Pt1(:,1);
c2(:,t)=Pt1(:,2);
K(:,t)=-inv(R+B'*Pt1*B)*B'*Pt1*A;
Pt1=P;
end

% Simulación
for t=2:N
x(:,t)=A*x(:,t-1)+B*K(:,t-1)'*x(:,t-1);
end

15

LQR algorithm matlab example

A= Kt

0.7094 0.2760
0.7547 0.6797

B=

0.6551
0.1626

Qf=100*eye(2);
Q=50*eye(2);
R=20;

16

16
LQR algorithm matlab example

A= Kt

0.7094 0.2760
0.7547 0.6797

B=

0.6551
0.1626

Qf=100*eye(2);
Q=50*eye(2);
R=20;

17

17

LQR algorithm matlab example

A= xt

0.7094 0.2760
0.7547 0.6797

B=

0.6551
0.1626

Qf=100*eye(2);
Q=50*eye(2);
R=20;
x0=[5;2]
18

18
Limits of P and K
(infinite horizon)

19

LQR algorithm matlab

for t=N:-1:1
P=Q+A'*Pt1*A-A'*Pt1*B*inv(R+B'*Pt1*B)*B'*Pt1*A;
c1(:,t)=Pt1(:,1);
c2(:,t)=Pt1(:,2);
K(:,t)=-inv(R+B'*Pt1*B)*B'*Pt1*A;
Pt1=P;
end

% Simulación
for t=2:N
% x(:,t)=A*x(:,t-1)+B*K(:,t-1)'*x(:,t-1);
xc(:,t)=A*x(:,t-1)+B*K(:,1)'*x(:,t-1);
end

20
LQR algorithm matlab example

A= x con Kcte

0.7094 0.2760
0.7547 0.6797

B=

0.6551
0.1626

Qf=100*eye(2);
Q=50*eye(2);
R=20;
x0=[5;2]
21

21

You might also like