Given a linear system with A matrix 4x4 and B matrix having 2 columns 4 rows I want to solve a LMI problem to determine the K that stabilize the linear system.
\begin{equation} \dot{x} = Ax + Bu\\ u = -Kx \end{equation}
and said $A-BK$ the closed loop dynamics the Lyapunov functions led us to this inequality. \begin{equation} (A - BK)^T P + P (A - BK) < 0 \end{equation} I do all the calculations and the multiply by $P^{-1}$ and P both sides of the inequality and making the position $S = P^{-1}$, $L=K*P^{-1}$. I get: \begin{equation} S \cdot A' + A \cdot S + L' \cdot B + B \cdot L \leq 0 \end{equation} Where $S$ and $L$ are my unknowns, the problem is that i have no idea which dimension I should set the L, I tried $2x2, 4x2, 2x4$ But given the dimension of $B$ it's always not doable. Do you know which is the problem?
I am not sure if there's a mistake in your post. Are you trying to compute the following?
$$ \mathbf{P}^{-1}\left[ \left(\mathbf{A}-\mathbf{B}\mathbf{K}\right)^{\top}\mathbf{P}+ \mathbf{P}\left(\mathbf{A}-\mathbf{B}\mathbf{K}\right) \right]\mathbf{P}^{-1} = \mathbf{P}^{-1}\mathbf{A}^{\top}+ \mathbf{A}\mathbf{P}^{-1}- \mathbf{P}^{-1}\mathbf{K}^{\top}\mathbf{B}^{\top}- \mathbf{B}\mathbf{K}\mathbf{P}^{-1} $$
If this is the case, you forgot to transpose the matrix $\mathbf{B}$ in the third term and the size of $\mathbf{L}$ should be $2\times 4$.