# Observable canonical form - Transfer function to state space

Let's say that I have a transfer function: $$G(s) = \frac{0s^4 + 3s^3 + 2s^2 - 2s - 4}{10s^4 + 2s^3 + s^2 -0s + 10}$$

And I get the state space model by using observable canonical form:

$$A = \begin{bmatrix} -0.2 & 1 & 0 &0 \\ -0.1 & 0 & 1 & 0\\ 0 & 0 & 0 & 1\\ -1 & 0 & 0 & 0 \end{bmatrix}$$

$$B = \begin{bmatrix} 0.3\\ 0.2\\ -0.2\\ 0.4 \end{bmatrix}$$

$$C = \begin{bmatrix} 1 & 0 &0 &0 \end{bmatrix}$$ $$D = 0$$

What I did is to divide the transfer function $G(s)$'s element with 10. $$G(s) = \frac{0s^4 + 0.3s^3 + 0.2s^2 - 0.2s - 0.4}{s^4 + 0.2s^3 + 0.1s^2 -0s + 1}$$

Here we can cleary see which values are stored in the state space model.

But let's say that we have a transfer function which looks like this: $$G(s) = \frac{-2s^5 + 2s^4 + 3s^3 + 2s^2 - 2s - 4}{10s^4 + 2s^3 + s^2 -0s + 10}$$

I divide it with 10: $$G(s) = \frac{-0.2s^5 + 0.2s^4 + 0.3s^3 + 0.2s^2 - 0.2s - 0.4}{s^4 + 0.2s^3 + 0.1s^2 -0s + 1}$$

And here is my state space model:

$$A = \begin{bmatrix} -1 & 1 & 0 & 0 & 0\\ -0.2 & 0 & 1 &0 & 0 \\ -0.1 & 0 & 0 & 1 & 0\\ 0 & 0 & 0 & 0 & 1\\ -1 & 0 & 0 & 0 & 0 \end{bmatrix}$$

$$B = \begin{bmatrix} 0.2 - 1*(-0.2) = 0.4\\ 0.3 - 0.2*(-0.2) = 0.34\\ 0.2 - 0.1*(-0.2) = 0.22\\ -0.2 - 0*(-0.2) = -0.20\\ 0.4 - 1*(-0.2) = 0.60 \end{bmatrix}$$

$$C = \begin{bmatrix} 1 & 0 &0 &0 & 0 \end{bmatrix}$$ $$D = -0.2$$

Question:

Is it right that I need to divide all elements in the denomerator and numerator with the scalar of denomerator highest order? In this case it's 10.

Should I do that with all transfer functions? Or is it not necessary to get a transfer function on standard form in this case or all cases?

• Your second transfer function is non-causal, namely the order of the numerator is higher than that of the denominator. For such a system there does not exist an equivalent state space model. – Kwin van der Veen Sep 9 '17 at 23:20
• @KwinvanderVeen Yes it's exist according to MATLAB. But in reality, denomerator is allways bigger that the numerator. I'm building a control library for Octave and MATLAB. Octave allready have a control library but I don't trust it because that library does not give the same results as MATLAB's control library. – Daniel Mårtensson Sep 9 '17 at 23:30
• MATLAB might return a state space model but its dynamics will be of the form $E\,\dot{x}=A\,x+B\,u$ where $E$ is singular. – Kwin van der Veen Sep 10 '17 at 0:07
• @KwinvanderVeen have a look at this lpsa.swarthmore.edu/Representations/SysRepTransformations/… down below. – Daniel Mårtensson Sep 10 '17 at 10:03
• @KwinvanderVeen Does it happens that the denomerator is $[0,1,2,3,4]$ Or does this never happen? – Daniel Mårtensson Sep 10 '17 at 10:22