# Issue with implementation of Kalman Filter for state estimation

I stumbled upon an issue while trying to implement a load current observer for the UPS inverter system. The issue I am facing is with the matrices describing the observer dynamics presented in a paper I'm using for a course project. The problem is to estimate the load currents in a UPS system.

The equation of estimated states is given by, $$\dot{x} = A_ox_o + B_ou_o\\ y = C_ox_o$$ where $$x_o$$ is the estimated state vector. The matrix $$A_o$$ and $$B_o$$ are given as,

$$A_o = \begin{bmatrix} 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0\\ -k_1 & 0 & 0 & \omega \\ 0 & -k_1 & -\omega & 0 \end{bmatrix}$$

$$B_o = C_o^T = \begin{bmatrix} 0 & 0\\ 0 & 0\\ 1 & 0\\ 0 & 1 \end{bmatrix}$$

The aim is to next find the matrix $$P_o$$ using the Filter Algebraic Riccati Equation given by,

$$A_oP_o + P_oA_o^T - P_oC_o^TR_o^{-1}C_oP_o + Q_o = 0$$

Then, $$L$$ can be found by,

$$L = -P_oC_o^TR_o^{-1}$$

where, $$Q_o$$ and $$R_o$$ are 4x4 and 2x2 positive definite symmetric matrices

The existence of a unique positive definitene solution $$P_o$$ can then be guranteed by the theorem,

If $$(A_o,\sqrt{Q_o})$$ is reachable and $$(C_o,A_o)$$ is observable the error system using the gain L, with $$P_o$$ the unique positive definite solution to the Algebraic Filter Riccati Equation, is asymptotically stable

Now that the problem is all set up, when I run care.m on Matlab, by the command,

[Po, Poles , Lo, info] = icare(Ao,Co',Qo,Ro);


returns an error,

No solution found since the Hamiltonian spectrum, denoted by [L;-L], has eigenvalues on the imaginary axis


I made sure that I was giving correct values of $$Q_o$$ such that the statement of the theorem is satisfied and proceeded to run the icare command. Can anyone give any valuable inputs/suggestions on why this is happening and how I may possibly solve this issue?

Thank you.

• In the matlab function icare is the matrix A defined differently, namely as a transpose of what you assumed. Therefore, icare(Ao',Co',Qo,Ro) should give you the intended solution. Apr 25, 2021 at 23:22
• @KwinvanderVeen Thank you very much for this suggestion. This solved my issue. :) Apr 26, 2021 at 3:15
• I believe the definitions of the matrices used in icare are chosen as such to match the algebraic Riccati equation related to LQR better (that is also why Co also needed to be transposed). Apr 26, 2021 at 7:07