# How to improve reference tracking using state feedback?

Suppose that I have a state-space system $$A, B, C, D$$ and a gains matrix $$K$$ computed via LQR. I would like to track a reference signal $$x_{cmd}$$. I do so by using the control law:

$$u = -K(x - x_{cmd})$$

where $$x$$ is the system state.

How do I develop a feed-forward term as a function of $$x_{cmd}$$ to encourage the system to follow the reference more closely, particularly in the case of time-varying $$t_{cmd}$$?

• Ever heard of the internal model principle? If you know the frequency components of the reference, you can design a compensator with poles with ressonance at such frequencies. Then think of the system with the augmented states of the compensator and apply LQR. – Vicente Cunha May 28 '18 at 22:12

In the case that there are no other inputs acting on the system and the system starts at $x=x_\mathrm{cmd}$, then in order to ensure that you keep perfect tracking you also need that $\dot{x}=\dot{x}_\mathrm{cmd}$. This can be achieved by solving for $u_\mathrm{cmd}$ in

$$\dot{x}_\mathrm{cmd} = A\,x_\mathrm{cmd} + B\,u_\mathrm{cmd}. \tag{1}$$

This does require that $x_\mathrm{cmd}$ is a feasible trajectory as a function of time, namely $\dot{x}_\mathrm{cmd} - A\,x_\mathrm{cmd}$ should lie in the span of $B$. If this is the case, then the feedforward term can be found using a pseudo inverse if $B^\top\,B$ is full rank

$$u_\mathrm{cmd} = \left(B^\top\,B\right)^{-1} B^\top\left(\dot{x}_\mathrm{cmd} - A\,x_\mathrm{cmd}\right). \tag{2}$$

So the total control law would become

$$u = u_\mathrm{cmd} - K\,(x - x_\mathrm{cmd}). \tag{3}$$

From here by defining $e = x - x_\mathrm{cmd}$, under the assumption that no other inputs are acting on the system, then it can be shown that the dynamics of $e$ becomes

$$\dot{e} = (A - B\,K)\,e. \tag{4}$$

So if $A-B\,K$ is Hurwitz, then as time goes to infinity $e$ should go to zero. And when $e=0$ by definition you also have $x = x_\mathrm{cmd}$.