# Lineal Quadratic Regulator

In this short tutorial, we explain how to use Riccati’s theory to solve an LQ control problem with targets. The related MATLAB code is downloadable freely. We start considering the case of finite time horizon to later address the case of infinite time horizon.

## Finite time horizon

We consider the optimal control problem:

where

In the above control problem, , , and . The control , while the state . The control target is and the state target is . and are positive parameters.

By the Direct Methods in the Calculus of Variations and strict convexity, the above problem admits an unique optimal control.

We compute the optimal pair (optimal control, optimal state) by using the well-known Riccati’s theory (see, for instance, [1, Lemma 2.6] and [2, section 4.3]).

For further details regarding the algorithm, we refer to RiccatiAlgorithm.pdf.

### Example

Take

Choose , , , , and T=10. We obtain figures state_1.png, state_2.png and control.png.

Since the parameter is large enough and the control acts only on the first component of the state equation

- the first component of the state is close to the target;
- the second component of the state is less close to the target;
- the control is far from its target.

The algorithm described in this guide can be employed to test the fulfillment of the turnpike property (see, e.g., [1] and [3]). In agreement with the theory, the turnpike effect is evident if:

- the targets are constants;
- (A,B) is controllable;
- (A,C) is observable, and ;
- the time horizon T is large enough.

## Infinite time horizon

We consider the optimal control problem

where:

In the above control problem, , and The control , while the state . The control target is and the state target is . and are positive parameters.

**Assumptions**

- the targets and satisfies the equation

- (A,B) is controllable and (A,C) is observable.

The above assumptions guarantee the existence of a control such that . By the Direct Methods in the Calculus of Variations and strict convexity, the above problem admits an unique optimal control.

Further details are available in the second section of RiccatiAlgorithm.pdf.

## Author

**Dario Pighin**

## References

[1] A. PORRETTA and E. ZUAZUA, *Long time versus steady state optimal control*, SIAM Journal
on Control and Optimization, 51 (2013), pp. 4242–4273.

[2] E. TRÉLAT, *Contrôle optimal: théorie & applications*, Vuibert, 2008.

[3] E. TRÉLAT and E. ZUAZUA, *The turnpike property in finite-dimensional nonlinear optimal control*, Journal of Differential Equations, 258 (2015), pp. 81–114.

## Acknowledgments

This project has received funding from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (grant agreement No. 694126-DyCon).