# Computing error dynamics from state space deadbeat observer

I'm trying to solve this problem:

Given the transfer function:

$$G(z) = \frac{z^{2}+2z+1}{z^{3}-z^{2}-5z+1}$$

Design a deadbeat observer for this transfer function and compute the error dynamics $e(0)=e$.

I know that to design a deadbeat observer, you should first convert the transfer function to an observable canonical form, then design your observer to place the poles of the transfer function at 0.

I know that $e(k+1)=(A-LC)e(k)$, which I'm guessing I have to use. I can find the matrix $(A-LC)$ but not any of the other matrices. This is where I'm stuck; how do I compute the error dynamics?

One state space representation of $G(z)$ is,

$$\begin{array}{l c r} A = \begin{bmatrix} 0 & 0 & -1 \\ 1 & 0 & 5 \\ 0 & 1 & 1 \end{bmatrix} & B = \begin{bmatrix} 1 \\ 2 \\ 1 \end{bmatrix} & C = \begin{bmatrix} 0 & 0 & 1 \end{bmatrix} \end{array}$$

with dynamics,

$$x(t+1) = A\,x(t) + B\,u(t)$$

$$y(t) = C\,x(t)$$

You want to find a $L$ and $K$, such that both $A-L\,C$ and $A-B\,K$ have of its eigenvalues at zero. Since I already put the system in the observable canonical form, finding $L$ will be easy, namely the last column of $A$. In order to find $K$ it might be easier to transform the system to the controllable canonical form, find $K$ there and transform it back.

You can now estimate the internal states of the system $x(t)$ with $\hat{x}(t)$, using information from $y(t)$, $u(t)$ and the dynamics of the system,

$$\hat{x}(t+1) = L\,y(t) + \left(A - L\,C\right) \hat{x}(t) + B\,u(t)$$

If you choose the input $u(t)$ as follows,

$$u(t) = -K\,\hat{x}(t)$$

and define $e(t)$ as the error between the actual state $x(t)$ and its prediction $\hat{x}(t)$,

$$e(t) = x(t) - \hat{x}(t)$$

then the total dynamics of the system can be written as,

$$\begin{bmatrix} x(t+1) \\ e(t+1) \end{bmatrix} = \begin{bmatrix} A - B\,K & B\,K \\ 0 & A - L\,C \end{bmatrix} \begin{bmatrix} x(t) \\ e(t) \end{bmatrix}$$

However you have chosen the eigenvalues of each matrix on the diagonal to have all zero eigenvalues, so after six step the system will always go to zero (independent of how good your initial guess is for $\hat{x}(t)$).