Consider the transfer function matrix $G(s)$ of a continuous-time system given by: $G(s) = \begin{bmatrix}\frac{1}{s^2+2s}&\frac{s+1}{s} \\ -\frac{1}{s+1} & \frac{1}{s^2+4s+3} \end{bmatrix}$
Suppose that $(A,B,C,D)$ is a state-space model that forms a minimal realization. What is the dynamic order of this system (i.e., the dimension of the state-space)?
My approach:
If you take the individual $A$ matrices of these transfer functions you get:
$G(s) = \begin{bmatrix} A_{11}&A_{12} \\ A_{21}&A_{22} \end{bmatrix} \quad$ in which:
$ A_{11}= \begin{bmatrix} 0&1\\0&-2 \end{bmatrix}, \quad A_{12}= \begin{bmatrix} 0 \end{bmatrix}$
$A_{21}= \begin{bmatrix} -1 \end{bmatrix}, \quad A_{22}=\begin{bmatrix} 0&1 \\-3&-4 \end{bmatrix}$
Does the fact that $A_{11}$ and $A_{22}$ are both 2x2 mean that $G(s)$ is of order 4?
There are multiple ways of doing this, but if you are only interested in the dynamic order of the system then evaluating the McMillan degree would be one of the fastest. The McMillan degree is the order of the pole polynomial, where Multivariable feedback control: analysis and design from S. Skogestad and I. Postlethwaite define the pole polynomial of a transfer function matrix as:
Another option is to construct a potentially non-minimal state space realization and then find its minimal realization (for example by calculating its Kalman decomposition). This can be done by first finding a state space realization of each (SISO) transfer function at the $n$th row and $m$th column of $G(s)$ denoted by $(A_{nm},B_{nm},C_{nm},D_{nm})$. These SISO state space models can then be combined into one state space model. For your $G(s)$ with two inputs and two outputs the state space model can be constructed using
$$ \left[\begin{array}{c|c} A & B \\ \hline C & D \end{array}\right] = \left[\begin{array}{c c c c|c c} A_{11} & 0 & 0 & 0 & B_{11} & 0 \\ 0 & A_{12} & 0 & 0 & 0 & B_{12} \\ 0 & 0 & A_{21} & 0 & B_{21} & 0 \\ 0 & 0 & 0 & A_{22} & 0 & B_{22} \\ \hline C_{11} & C_{12} & 0 & 0 & D_{11} & D_{12} \\ 0 & 0 & C_{21} & C_{22} & D_{21} & D_{22} \end{array}\right]. $$
You can also let Matlab do all the work for you by using
minreal(ss(G)). Namelytf2ss()only accepts the numerator and denominator inputs to be row vectors, while for the MIMO case the numerator and denominator are cell arrays containing the row vectors. But usingss()on a transfer function directly converts it into a state space model, instead of first returning the separate matrices.