# LMIs in Control/Click here to continue/Optimal control systems/H2-Optimal Filtering

LMIs in Control/Click here to continue/Optimal control systems/H2-Optimal Filtering
For systems that have disturbances, filtering can be used to reduce the effects of these disturbances. Described on this page is a method of attaining a filter that will reduce the effects of the disturbances as completely as possible. To do this, we look to find a set of new coefficient matrices that describe the filtered system. The process to achieve such a new system is described below. The H2-filter tries to minimize the average magnitude of error.

## The System

For the application of this LMI, we will look at linear systems that can be represented in state space as
    ${\begin{aligned}{\dot {x}}&=Ax+Bw,x(0)=x_{0}\\y&=Cx+Dw\\z&=Lx\end{aligned}}$
where $x\in R^{n},y\in R^{l},z\in R^{m}$ represent the state vector, the measured output vector, and the output vector of interest, respectively, $w\in R^{p}$ is the disturbance vector, and $A,B,C,D$ and $L$ are the system matrices of appropriate dimension. To further define: $x$ is $\in R^{n}$ and is the state vector, $A$ is $\in R^{n*n}$ and is the state matrix, $B$ is $\in R^{n*r}$ and is the input matrix, $w$ is $\in R^{r}$ and is the exogenous input, $C$ is $\in R^{m*n}$ and is the output matrix, $D$ and $L$ are $\in R^{m*r}$ and are feedthrough matrices, and $y$ and $z$ are $\in R^{m}$ and are the output and the output of interest, respectively.

## The Data

The data are $w$ (the disturbance vector), and $A,B,C,D$ and $L$ (the system matrices). Furthermore, the $A$ matrix is assumed to be stable

## The Optimization Problem

We need to design a filter that will eliminate the effects of the disturbances as best we can. For this, we take a filter of the following form:
       ${\begin{aligned}{\dot {\sigma }}&=A_{f}\sigma +B_{f}y,\sigma (0)=\sigma _{0}\\{\hat {z}}&=C_{f}\sigma ,\end{aligned}}$
where $\sigma \in R^{n}$ is the state vector, ${\hat {z}}\in R^{m}$ is the estimation vector, and $A_{f},B_{f},C_{f}$ are the coefficient matrices of appropriate dimensions.
Note that the combined complete system can be represented as
       ${\begin{aligned}{\dot {x}}_{e}&={\tilde {A}}x_{e}+{\tilde {B}}w,x_{e}(0)=x_{e0}\\{\tilde {z}}&={\tilde {C}}x_{e},\end{aligned}}$
where ${\tilde {z}}=z-{\hat {z}}\in R^{m}$ is the estimation error,
       ${\begin{aligned}x_{e}={\begin{bmatrix}x\\\sigma \end{bmatrix}}\\\end{aligned}}$
is the state vector of the system, and ${\tilde {A}},{\tilde {B}},{\tilde {C}}$ are the coefficient matrices, defined as:
       ${\begin{aligned}{\tilde {A}}={\begin{bmatrix}A&0\\B_{f}C&A_{f}\end{bmatrix}},{\tilde {B}}={\begin{bmatrix}B\\B_{f}D\end{bmatrix}},\\{\tilde {C}}={\begin{bmatrix}L&-C_{f}\end{bmatrix}}\end{aligned}}$
In other words, for the system defined above we need to find $A_{f},B_{f},C_{f}$ such that
       ${\begin{aligned}||G_{{\tilde {z}}w}(s)||_{2}<\gamma ,\end{aligned}}$
where $\gamma$ is a positive constant, and
       ${\begin{aligned}G_{{\tilde {z}}w}(s)={\tilde {C}}(sI-{\tilde {A}})^{-1}{\tilde {B}}\end{aligned}}$

## The LMI: H-2 Filtering

For this LMI, the solution exists if one of the following sets of LMIs hold:
Matrices $R,X,M,N,Z,Q$ exist that obey the following LMIs:
       ${\begin{aligned}R-X&>0,\\trace(Q)&<\gamma ^{2},\\{\begin{bmatrix}-Q&*&*\\L^{T}&-R&*\\-N^{T}&-X&-X\end{bmatrix}}&<0,\\{\begin{bmatrix}RA+A^{T}R+ZC+C^{T}Z^{T}&*&*\\M^{T}+ZC+XA&M^{T}+M&*\\B^{T}R+D^{T}Z^{T}&B^{T}X+D^{T}Z^{T}&-I\end{bmatrix}}&<0.\\\end{aligned}}$
or
Matrices ${\bar {R}},{\bar {X}},{\bar {M}},{\bar {N}},{\bar {Z}},{\bar {Q}}$ exist that obey the following LMIs:
       ${\begin{aligned}{\bar {R}}-{\bar {X}}&>0,\\trace({\bar {Q}})&<\gamma ^{2},\\{\begin{bmatrix}-{\bar {Q}}&*&*\\{\bar {R}}B+{\bar {Z}}D&-{\bar {R}}&*\\{\bar {X}}B+{\bar {Z}}D&-{\bar {X}}&-I\end{bmatrix}}&<0,\\{\begin{bmatrix}{\bar {R}}A+A^{T}{\bar {R}}+{\bar {Z}}C+C^{T}{\bar {Z}}^{T}&*&*\\{\bar {M}}^{T}+{\bar {Z}}C+{\bar {X}}A&{\bar {M}}^{T}+{\bar {M}}&*\\L&-{\bar {N}}&-I\end{bmatrix}}&<0.\\\end{aligned}}$

## Conclusion:

To find the corresponding filter, use the optimized matrices from the first solution to find:
       $A_{f}=X^{-1}M,B_{f}=X^{-1}Z,C_{f}=N$
Or the second solution to find:
       $A_{f}={\bar {X}}^{-1}{\bar {M}},B_{f}={\bar {X}}^{-1}{\bar {Z}},C_{f}={\bar {N}}$
These matrices can then be used to produce ${\tilde {A}},{\tilde {B}},{\tilde {C}}$ to construct the final filter below, that will best eliminate the disturbances of the system.
       ${\begin{aligned}{\dot {x}}_{e}&={\tilde {A}}x_{e}+{\tilde {B}}w,x_{e}(0)=x_{e0}\\{\tilde {z}}&={\tilde {C}}x_{e},\end{aligned}}$

## Implementation

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

## Related LMIs

H-infinity filtering

## External Links

This LMI comes from
* - "LMIs in Control Systems: Analysis, Design and Applications" by Guang-Ren Duan and Hai-Hua Yu
Other resources:
* LMI Methods in Optimal and Robust Control - A course on LMIs in Control by Matthew Peet.
* LMI Properties and Applications in Systems, Stability, and Control Theory - A List of LMIs by Ryan Caverly and James Forbes.
* LMIs in Systems and Control Theory - A downloadable book on LMIs by Stephen Boyd.

## References

Duan, G. (2013). LMIs in control systems: analysis, design and applications. Boca Raton: CRC Press, Taylor & Francis Group.