Short introduction
In many application cases where some of the system states can't be measured, we can use a state observer. One solution would be the Kálmán filter which I already presented. Another solution is the $H_\infty$ filter which is robust regarding the unpredictable noise source. In the Kálmán filter not only the noise process needs to be zero mean, but also the $Q$, $R$ covariance matrices have to be known, without them we can't design an appropriate observer. While in the $H_\infty$ filter doesn't make any assumptions about the noise, it minimizes the worst case estimation error.
Discrete $H_\infty$ filter design
We have the following discrete-time system
xk+1=Akxk+Bkuk+wkyk=Ckxk+Dkuk+vk
The $1$ system has to be controllable and observable. We would like to achieve a small estimation error $e_k=z_k - \hat{z}_k$ for any $w_k,v_k$. In this case we want to solve the minimax problem as follows:
minxmaxw,vJ
where $J$ is:
J=N−1∑k=0||zk−ˆzk||2Qk||x0−ˆx0||2P0+N−1∑k=0||wk||2Wk+||vk||2Vk
Theorem: Let $\gamma>0$ be a prescribed level of noise attenuation. Then there exists a $H_\infty$ filter for $z_k$ if and only if there exists a stabilizing symmetric solution $P_k>0$ to the following discrete-time Ricatti equation:
Pk+1=AkPk(I−γQkPk+CTkV−1kCkPk)−1ATk+BkWkBTk
where
ˆxk+1=Aˆxk+Buk+Kk(yk−Ckˆxk)
The $K_k$ is the gain of the $H_\infty$ filter and it is given by:
Kk=AkPk(I−γQkPk+CTkV−1kCkPk)−1CTkV−1k
Proof: Xuemin Shen and Li Deng: Game Theory Approach to Discrete $H_\infty$ Filter Design
As you can see the filter gain doesn’t depend from the states of the system so it's possible to calculate offline.
Readings:
Theorem: Let $\gamma>0$ be a prescribed level of noise attenuation. Then there exists a $H_\infty$ filter for $z_k$ if and only if there exists a stabilizing symmetric solution $P_k>0$ to the following discrete-time Ricatti equation:
Pk+1=AkPk(I−γQkPk+CTkV−1kCkPk)−1ATk+BkWkBTk
where
ˆxk+1=Aˆxk+Buk+Kk(yk−Ckˆxk)
The $K_k$ is the gain of the $H_\infty$ filter and it is given by:
Kk=AkPk(I−γQkPk+CTkV−1kCkPk)−1CTkV−1k
Proof: Xuemin Shen and Li Deng: Game Theory Approach to Discrete $H_\infty$ Filter Design
As you can see the filter gain doesn’t depend from the states of the system so it's possible to calculate offline.
Cpp implementation
On github you can find a C++ implementation of the $H_\infty$ filter, this is only a chunk of the C++ class./* *@summary: The filter gain calculation *@param A: State space model A matrix *@param B: State space mode B matrix *@return: Filter Gain */ MatrixHINF::calkGain(Matrix A, Matrix B) { if (A.rows() != P.cols()) ERRORH::throwerror("A rows has to be equal with P columns"); Matrix I = Matrix ::Identity(A.cols(), A.cols()); Matrix L = (I - lambda * Q * P + C.transpose() * V.inverse() * C * P).inverse(); P = A * P * L * A.transpose() + B * W * B.transpose(); K = A * P * L * C.transpose() * V.inverse(); return K; } /* *@summary: Update the state *@param A: State space model A matrix *@param B: State space mode B matrix *@return: The new state */ Matrix HINF::updateState(Matrix A, Matrix B, Matrix u) { x = A * x + B * u; return x; } /* *@sumary: Estimate the next states *@param M: Measured state */ Matrix HINF::estimate(Matrix M) { x = x + K * (M - C * x); return x; }
Readings:
- Kemin Zhou: ESSENTIALS OF ROBUST CONTROL
- Xuemin Shen and Li Deng: Game Theory Approach to Discrete $H_\infty$ Filter Design