So I have a state-space system, \begin{eqnarray} \dot{\mathbf{x}}&=&A\mathbf{x} + B\mathbf{u}\tag{1}\label{EqSS}\\ \mathbf{y}&=&C\mathbf{x}\\ \end{eqnarray} where, \begin{eqnarray} \mathbf{x}&=&\begin{bmatrix}x_1&x_2& \cdots&x_{11} & x_{12}\end{bmatrix}^\intercal\tag{2}\\ \mathbf{u}&=&\begin{bmatrix}u_1&u_2&u_3 & u_4\end{bmatrix}^\intercal\\ A&\in&\mathbb{R}^{12\times 12}\\ B&\in&\mathbb{R}^{12\times 4}\\ C&=&I\in\mathbb{R}^{12\times 12} \end{eqnarray} I am using the following control law for tracking commanded state values $\mathbf{x}^c\in\mathbb{R}^{12\times 1}$, \begin{equation}\label{EqUctrl} \mathbf{u}=-K\left(\mathbf{x}-\mathbf{x}^c\right)=K\left(\mathbf{x}^c-\mathbf{x}\right)\tag{3} \end{equation} where gains matrix $K\in\mathbb{R}^{4\times 12}$ is calculated using the $\texttt{lqr(A,B,Q,N)}$ function in $\texttt{Matlab}$.

It turns out tracking performance is quite good for all states but $x_{12}$ when using my selections for state weight and input weight matrices $Q\in\mathbb{R}^{12\times 12}$ and $R\in\mathbb{R}^{4\times 4}$. State $x_{12}$ tends to $x^c_{12}$ as simulation time goes by but is typically offset by say 10 %.


  1. How do I go about augmenting an integrator state $\dot{x}_{13}=x^c_{12}-x_{12}$ to \eqref{EqSS} and \eqref{EqUctrl}?

  2. My current plan for augmenting an integrator state $\dot{x}_{13}=x^c_{12}-x_{12}$ to \eqref{EqSS} and \eqref{EqUctrl} is to,

    • add a 13th row and column to system matrix $A$ according to, \begin{eqnarray} \text{Row 13: }&&\begin{bmatrix} a_{13,1} & a_{13,2} & \cdots & a_{13,11} & a_{13,12} & a_{13,13} \end{bmatrix}\phantom{\hspace{1mm}}= \begin{bmatrix} 0 & 0 & \cdots & 0 & -1 & 0 \end{bmatrix}\\ \text{Column 13: }&&\begin{bmatrix} a_{1,13} & a_{2,13} & \cdots & a_{11,13} & a_{12,13} & a_{13,13} \end{bmatrix}^\intercal= \begin{bmatrix} 0 & 0 & \cdots & 0 & \phantom{-}0 & 0 \end{bmatrix} \end{eqnarray}
    • add a 13th row to input signal matrix $B$ according to, \begin{equation} \text{Row 13: }\begin{bmatrix} b_{13,1} & b_{13,2} & b_{13,3} & b_{13,4} \end{bmatrix} \end{equation}
    • with the augmented matrices $A,B$ at hand calculate a new gain matrix $K$ for the control law \eqref{EqUctrl}.

    Do these steps seem appropriate to you guys? I am a bit puzzled on how to do this because of the material I have found on the Internet,
    Lec 6: State Feedback, Controllability, Integral Action (p.31-33)
    DC Motor Position: State-Space Methods for Controller Design

    What confuses me perhaps is the control law \eqref{EqUctrl} I am using which is a bit different from the often occuring $u=r-K\mathbf{x}$. Perhaps is $u=r-K\mathbf{x}$ applicable to single input systems only, but I guess it depends on how you would specify $r$?

  3. As for the control law I am using \eqref{EqUctrl} I found it here,
    MIT: Maneuvering and Control of Marine Vehicles
    StackExchange: How to improve reference tracking using state feedback?

    The control law performs well (apart from "that" state) and works nicely with the system description I have in terms of matrix sizes. Can anyone explain how you would expand or re-write $u=r-K\mathbf{x}$ to \eqref{EqUctrl}, derive \eqref{EqUctrl} or perhaps refer to a book or technical paper where this is done? I am more used to seeing $u=r-K\mathbf{x}$.

  • $\begingroup$ I could be wrong, but AFAIK, LQR is really meant for driving the states towards zero and not towards a commanded value. According to the aircraft example in Matlab's help page for lqr(), they reduce tracking error by increasing the weights for the corresponding state. They appear to provide a different function lqgtrack for tracking and it mentions an integrator. $\endgroup$
    – AJN
    Feb 9 at 14:31
  • 1
    $\begingroup$ You’re definitely correct about the purpose of LQR driving states to zero. Perhaps one could view this problem in terms of driving the state vector $\tilde{\mathbf{x}}=\mathbf{x}-\mathbf{x}^c$ to zero? I’m going to investigate that I think. As for my idea on integration action it turned out my plan worked, the state tends to the desired value having introduced the augmented integrator state. $\endgroup$
    – wolfiesax
    Feb 9 at 21:56
  • $\begingroup$ If your implementation worked, you can post it as an answer here. It will help future readers. Self answers are allowed in SE. $\endgroup$
    – AJN
    Feb 10 at 4:10
  • $\begingroup$ Ah ok. I will try to compile an answer then. $\endgroup$
    – wolfiesax
    Feb 10 at 8:41

1 Answer 1


I can confirm for the system at hand, augmenting an integrator state $\dot{x}_{13}=x^c_{12}-x_{12}$ can successfully be carried out by adding a $13^{\text{th}}$,

  1. row and column to system matrix $A$, \begin{eqnarray} \text{Row 13: }&&\begin{bmatrix} a_{13,1} & a_{13,2} & \cdots & a_{13,11} & a_{13,12} & a_{13,13} \end{bmatrix}\phantom{\hspace{1mm}}= \begin{bmatrix} 0 & 0 & \cdots & 0 & -1 & 0 \end{bmatrix}\\ \text{Column 13: }&&\begin{bmatrix} a_{1,13} & a_{2,13} & \cdots & a_{11,13} & a_{12,13} & a_{13,13} \end{bmatrix}^\intercal= \begin{bmatrix} 0 & 0 & \cdots & 0 & \phantom{-}0 & 0 \end{bmatrix} \end{eqnarray}
  2. row to input signal matrix $B$, \begin{equation} \text{Row 13: }\begin{bmatrix} b_{13,1} & b_{13,2} & b_{13,3} & b_{13,4} \end{bmatrix}=\begin{bmatrix} 0 & 0 & 0 & 0 \end{bmatrix} \end{equation}

Carrying out 1. and 2. means we have the augmented matrix sizes for the system and the controller, \begin{eqnarray} \mathbf{x}&=&\begin{bmatrix}x_1&x_2& \cdots&x_{11} & x_{12} & x_{13}\end{bmatrix}^\intercal\\ \mathbf{u}&=&\begin{bmatrix}u_1&u_2&u_3 & u_4\end{bmatrix}^\intercal\\ A&\in&\mathbb{R}^{13\times 13}\\ B&\in&\mathbb{R}^{13\times 4}\\ C&=&I\in\mathbb{R}^{13\times 13}\\ K&\in&\mathbb{R}^{4\times 13}\\ \end{eqnarray}


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.