# LMIs in Control/Click here to continue/Optimal control systems/Discrete-time H2-Hinf-optimal Dynamic output Feedback control

LMIs in Control/Click here to continue/Optimal control systems/Discrete-time H2-Hinf-optimal Dynamic output Feedback control
In many applications, perhaps even most, the state of the system cannot be directly known. In this case, you will need to strategically to measure key system outputs that will make the system states indirectly observable. Observers need to converge much faster than the system dynamics in order for their estimations to be accurate. Optimal observer synthesis is therefore advantageous. In this LMI, we seek to optimize both H2 and Hinf norms, to minimize both the average and the maximum error of the observer.

## The System

    ${\begin{aligned}x_{k+1}&=A_{d}x_{k}+B_{d1,1}w_{1,k}+B_{d1,2}w_{2,k},\\y_{k}&=C_{c2}x_{k}+D_{d21,1}w_{1,k}+D_{d21,2}w_{2,k}\\\end{aligned}}$
where $x\in R^{n}$ and is the state vector, $A\in R^{n*n}$ and is the state matrix, $B\in R^{n*r}$ and is the input matrix, $w\in R^{r}$ and is the exogenous input, $C\in R^{m*n}$ and is the output matrix, $D\in R^{m*r}$ and is the feedthrough matrix, $y\in R^{m}$ and is the output, and it is assumed that $(A_{d},C_{d2})$ is detectable.

## The Data

The matrices $A_{d},B_{d1},C_{cd2},C_{cd1},D_{d21}$.

## The Optimization Problem

An observer of the form:
    ${\begin{aligned}{\hat {x}}_{k+1}&=A_{d}{\hat {x}}_{k}+L_{d}(y_{k}-{\hat {y}}_{k}),\\{\hat {y}}_{k}&=C_{d2}{\hat {x}}_{k}\\\end{aligned}}$
is to be designed, where $L_{d}\in R^{n_{x}*n_{y}}$ is the observer gain.
Defining the error state $e_{k}=x_{k}-{\hat {x}}_{k}$, the error dynamics are found to be
$e_{k+1}=(A_{d}-L_{d}C_{d2})e_{k}+(B_{d1,1}-L_{d}D_{d21,1})w_{1,k}+(B_{d1,2}-L_{d}D_{d21,2})w_{2,k}$,
and the performance output is defined as
${\begin{bmatrix}Z_{1,k}\\Z_{2,k}\end{bmatrix}}={\begin{bmatrix}C_{d1,1}\\C_{d1,2}\end{bmatrix}}e_{k}+{\begin{bmatrix}0&D_{d11,12}\\D_{d11,21}&D_{d11,22}\end{bmatrix}}{\begin{bmatrix}w_{1,k}\\w_{2,k}\end{bmatrix}}$.
The observer gain $L_{d}$ is to be designed to minimize the $H_{2}$ norm of the closed loop transfer matrix $T_{11}(z)$ from the exogenous input $w_{2,k}$ to the performance output $z_{2,k}$ is less than $\gamma _{d}$, where
${\begin{aligned}T_{11}(z)&=C_{d1,1}(z1-(A_{d}-L_{d}C_{d2}))^{-1}(B_{d1,1}-L_{d}D_{d21,1}),\\T_{22}(z)&=C_{d1,2}(z1-(A_{d}-L_{d}C_{d2}))^{-1}(B_{d1,2}-L_{d}D_{d21,2})+D_{d11,22}\end{aligned}}$

## The LMI: Discrete-Time Mixed H2-Hinf-Optimal Observer

The discrete-time mixed-$H_{2}H_{inf}$-optimal observer gain is synthesized by solving for $P\in S^{n_{x}}$, $Z\in S^{n_{z}}$, $G_{d}\in R^{n_{x}*n_{y}}$, and $v\in R_{>0}$ that minimize J$(v)=v$ subject to $P>0,Z>0$,
       ${\begin{aligned}{\begin{bmatrix}P&PA_{d}-G_{d}C_{d2}&PB_{d1,1}-G_{d}D_{d21,1}\\*&P&0\\*&*&1\end{bmatrix}}&>0,\\{\begin{bmatrix}P&PA_{d}-G_{d}C_{d2}&PB_{d1,2}-G_{d}D_{d21,2}&0\\*&P&0&C_{d1,2}^{T}\\*&*&\gamma _{d}1&D_{d11,22}^{T}\\*&*&*&\gamma _{d}1\end{bmatrix}}&>0,\\{\begin{bmatrix}Z&PC_{d1,1}\\*&P\end{bmatrix}}&>0,\\trZ<v\end{aligned}}$
where $tr$ refers to the trace of a matrix.

## Conclusion:

The mixed-$H_{2}H_{inf}$-optimal observer gain is recovered by $L_{d}=P^{-1}G_{d}$, the $H_{2}$ norm of $T_{11}(z)$ is less than $\mu ={\sqrt {v}}$, and the $H_{inf}$ norm of $T_{22}(z)$ is less than $\gamma _{d}$. This result gives us a matrix of observer gains $L_{d}$ that allow us to optimally observe the states of the system indirectly as:
    ${\begin{aligned}{\hat {x}}_{k+1}&=A_{d}{\hat {x}}_{k}+L_{d}(y_{k}-{\hat {y}}_{k}),\\{\hat {y}}_{k}&=C_{d2}{\hat {x}}_{k}\\\end{aligned}}$

## Implementation

This implementation requires Yalmip and Sedumi.
https://github.com/rezajamesahmed/LMImatlabcode/blob/master/mixedh2hinfobsdiscretetime.m

## Related LMIs

Discrete-Time_Hinfinity-Optimal_Observer
Discrete-Time_H2-Optimal_Observer

## External Links

This LMI comes from Ryan Caverly's text on LMI's (Section 5.3.2):
* LMI Properties and Applications in Systems, Stability, and Control Theory - A List of LMIs by Ryan Caverly and James Forbes.
Other resources:
* LMI Methods in Optimal and Robust Control - A course on LMIs in Control by Matthew Peet.
* LMIs in Systems and Control Theory - A downloadable book on LMIs by Stephen Boyd.