How to I go from generalized Transfer Function to generalized State Space, and back?

Question: How can I transform a generalized Transfer Function a generalized state space form (preferable with the First Companion Form), and back?

For the sake of presenting an example, let us say that we have the following generalized transfer function: $$\begin{pmatrix}z\\y\end{pmatrix} = \begin{pmatrix}G(s) &-1\\ H(s)&0\end{pmatrix} \begin{pmatrix}w\\u\end{pmatrix}$$ with $$G(s)=\frac{2}{s+3}$$ and $$H(s)=\frac{s-1}{s+2}$$

I have not been able to find any information on the Internet related to this. I know how to do this when having one transfer function but don't know when having the generalized form.

• I'm voting to close this question as off-topic because homework needs an attempt at a solution – Voltage Spike Jun 25 '18 at 21:32
• This one is "plug and chug" – Voltage Spike Jun 25 '18 at 21:33
• You have to find the equivalent impulse function of G(s) and H(s). Since you don't know how u(s) looks, you have to make use of convolution integrals to solve it. If you have steady state condition and an sinusoidal input you can simple use s = 2*pi * f – abu_bua Jun 25 '18 at 22:25
• @laptop2d this is not homework. I was reading a text book (related to H_inf control design) and it had a generalized Transfer Function and then presented State Space representation. I want to learn how to get that state space representation (and go back to TF). I really tried to do it alone but I can't. If you feel I'm trying to trick you to do my "homework" then use a different generalized transfer function. I don't care, as long as I can learn it. – Dimitris Pantelis Jun 26 '18 at 10:18
• @DimitrisPantelis Can you link where you got it from? Otherwise, you can simply consider G(s) and H(s) as terms like a0, a1, b0, ... i.e. don't expand, the terms, consider them as a whole. – a concerned citizen Jun 26 '18 at 10:34

The transformation back, from a state-space model to a transfer function can be done with $$\C(sI-A)^{-1}B\$$, irrespective of the number of inputs and outputs. In general, you might not end up with a form $$\\begin{pmatrix} G(s) & -1 \\ H(s) & 0 \end{pmatrix}\$$ though.

The transformation from a transfer function (matrix) to a state-space model is not trivial in case of multiple inputs and multiple outputs. Only the cases with a single input and/or a single output can be solved in general with either the controllable canonical form (requires single input) or the observable canonical form (requires single output).

For example, for a single input two output system $$\begin{bmatrix} Y_1(s) \\ Y_2(s)\end{bmatrix} = \begin{bmatrix} G_1(s) \\ G_2(s)\end{bmatrix} U(s)$$ you can use the controllable canonical form. You would first have to put both transfer functions $$\G_1(s)\$$ and $$\G_2(s)\$$ on a common denominator and put the obtained denominator coefficients in the matrix $$\A\$$. The numerator coefficients go in the two rows of the matrix $$\C\$$. You cannot use the observable canonical form in this case, since then the numerator coefficients would have to go in the matrix $$\B\$$, but this matrix only has one column, while the numerator coefficients of $$\G_1(s)\$$ and $$\G_2(s)\$$ (also after putting them on a common denominator) are in general not equal to each other.

Similarly, for a two input single output case, you cannot use the controllable canonical form (the numerator coefficients of the two transfer functions should go in the matrix $$\C\$$, but in the single output case, the matrix $$\C\$$ only has one row). Moreover, the matrix $$\B\$$ now has two columns, but it should be filled with a bunch of zeros and a row of ones in the last row. This would essentially mean that instead of applying two inputs, you would effectively only have one input equal to the sum of the original two inputs: $$B u = \begin{bmatrix} 0 & 0 \\ \vdots & \vdots \\ 0 & 0 \\ 1 & 1 \end{bmatrix} \begin{bmatrix} u_1 \\ u_2 \end{bmatrix} = \begin{bmatrix} 0 \\ \vdots \\ 0 \\ 1 \end{bmatrix} (u_1 + u_2)$$ I hope this sheds some light on why it is in general impossible to use canoncial forms to transform multiple input multiple output transfer functions into state-space models.

Edit: A possible solution in the multiple input multiple output case is to consider the system as several multiple input single output systems and combine the state-space models of the different subsystems. Afterwards, you can probably apply some kind of model order reduction technique to reduce the number of state variables.

For example, in a two input two output case $$\begin{bmatrix} Y_1(s) \\ Y_2(s) \end{bmatrix} = \begin{bmatrix} G_{11}(s) & G_{12}(s) \\ G_{21}(s) & G_{22}(s) \end{bmatrix} \begin{bmatrix} U_1(s) \\ U_2(s) \end{bmatrix}$$ you could consider this as two subsystems, each with two inputs and a single output, and use an observable canonical form for each of them, say $$\begin{cases} \dot{x}_1 = A_1 x_1 + B_1 \begin{bmatrix} u_1 \\ u_2 \end{bmatrix} \\ y_1 = C_1 x_1 \end{cases}$$ and $$\begin{cases} \dot{x}_2 = A_2 x_2 + B_2 \begin{bmatrix} u_1 \\ u_2 \end{bmatrix} \\ y_2 = C_2 x_2 \end{cases}$$ Note that $$\x_1\$$ and $$\x_2\$$ are state vectors here, not just the first and the second element of a state vector $$\x\$$.

Next, you can combine the two state-space submodels: $$\begin{cases} \begin{bmatrix} \dot{x}_1 \\ \dot{x}_2 \end{bmatrix} = \begin{bmatrix} A_1 & 0 \\ 0 & A_2 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} + \begin{bmatrix} B_1 \\ B_2 \end{bmatrix} \begin{bmatrix} u_1 \\ u_2 \end{bmatrix} \\ \begin{bmatrix} y_1 \\ y_2 \end{bmatrix} = \begin{bmatrix} C_1 & 0 \\ 0 & C_2 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} \end{cases}$$ and like this obtain a state-space model of the two input two output system.

If I understand correctly these are known as "Canonical Forms."

There are a number of these, and each has its own uses. The image (and the rest of the information I'm using) can be found here. Transforming to a canonical form should be straightforward based upon these equations; transforming to a transfer function would involve matrix manipulations to match one of the canonical forms, then following the equations.

• I am familiar with how to do this with a single transfer function (like G(s) in my question). What I do now know is how to apply this when having a generalized transfer function form. – Dimitris Pantelis Jun 26 '18 at 10:24
• Unfortunately I do not know how to do that, sorry. Best of luck to you. – esilk Jun 26 '18 at 15:15