# Cascade of state space models for linear systems

I have two linear control system that are represented by their state space models

$$\left( \begin{array}{c|c} A_1 & B_1 \\ \hline C_1 & D_1 \\ \end{array} \right), \left( \begin{array}{c|c} A_2 & B_2 \\ \hline C_2 & D_2 \\ \end{array} \right)$$

where $A_i$ is the state matrix, $B_i$ is the input matrix, $C_i$ is the output matrix and $D_i$ is the feedworward matrix.

The output of the first system is a vector signal of dimension $n$, which is the same dimension of the input signal of the second system. I want to put these two systems in cascade. How can I calculate the total space state model $(A_T, B_T, C_T, D_T)$?

• A cascade is generally defined by a block diagram and not a state space realization. Without knowing how the systems are connected to each other its impossible to answer this. – SZN Mar 29 '17 at 17:51
• I've a block with N inputs and T ouputs, and I've the second block with T inputs and P outputs. The output of the first block is used as input of second block. Since I can model a block with a transfer function, and it's possible to convert a transfer function to a state space model and vice-versa, there should be the possibility to calculate the state space model of the system obtained by connecting the output to the first block to the input of the second block. – Jepessen Mar 29 '17 at 17:56

$$(1) :\begin{cases} \boldsymbol{\dot x}_1=\boldsymbol{A}_1 \boldsymbol{x}_1+\boldsymbol{B}_1 \boldsymbol{u}_1 \\ \boldsymbol{y}_1=\boldsymbol{C}_1 \boldsymbol{x}_1+\boldsymbol{D}_1 \boldsymbol{u}_1 \end{cases}$$

$$(2): \begin{cases} \boldsymbol{\dot x}_2=\boldsymbol{A}_2 \boldsymbol{x}_2+\boldsymbol{B}_2 \boldsymbol{u}_2 \\ \boldsymbol{y}_2=\boldsymbol{C}_2 \boldsymbol{x}_2+\boldsymbol{D}_2 \boldsymbol{u}_2 \end{cases}$$

I assume you mean the output of the first system is the input of the second system which means

$$\boldsymbol{u}_2=\boldsymbol{y}_1$$

Then you can reform the second system as

$$(2b)\begin{cases} \boldsymbol{\dot x}_2=\boldsymbol{A}_2 \boldsymbol{x}_2+\boldsymbol{B}_2 (\boldsymbol{C}_1 \boldsymbol{x}_1+\boldsymbol{D}_1 \boldsymbol{u}_1) \\ \boldsymbol{y}_2=\boldsymbol{C}_2 \boldsymbol{x}_2+\boldsymbol{D}_2 (\boldsymbol{C}_1 \boldsymbol{x}_1+\boldsymbol{D}_1 \boldsymbol{u}_1) \end{cases}$$

Combining (1) and (2b):

$$\begin{cases} \boldsymbol{\dot x}_1=\boldsymbol{A}_1 \boldsymbol{x}_1+\boldsymbol{B}_1 \boldsymbol{u}_1 \\ \boldsymbol{\dot x}_2=\boldsymbol{A}_2 \boldsymbol{x}_2+\boldsymbol{B}_2 \boldsymbol{C}_1\boldsymbol{x}_1+\boldsymbol{B}_2 \boldsymbol{D}_1 \boldsymbol{u}_1 \\ \boldsymbol{y}_2=\boldsymbol{C}_2 \boldsymbol{x}_2+\boldsymbol{D}_2 \boldsymbol{C}_1 \boldsymbol{x}_1+\boldsymbol{D}_2\boldsymbol{D}_1 \boldsymbol{u}_1 \end{cases}$$

Let's make it neat:

$$\begin{cases} &\begin{bmatrix}\boldsymbol{\dot x}_1\\ \boldsymbol{\dot x}_2\end{bmatrix}&=\begin{bmatrix} \boldsymbol{A}_1 & \boldsymbol{0}\\ \boldsymbol{B}_2\boldsymbol{C}_1 & \boldsymbol{A}_2 \end{bmatrix}\begin{bmatrix}\boldsymbol{x}_1\\\boldsymbol{x}_2\end{bmatrix} + \begin{bmatrix} \boldsymbol{B}_1\\ \boldsymbol{B}_2\boldsymbol{D}_1 \end{bmatrix}\boldsymbol{u}_1 \\ &\boldsymbol{y}_2&=\begin{bmatrix}\boldsymbol{D}_2\boldsymbol{C}_1&\boldsymbol{C}_2\end{bmatrix}\begin{bmatrix}\boldsymbol{x}_1\\\boldsymbol{x}_2\end{bmatrix}+\begin{bmatrix}\boldsymbol{D}_2\boldsymbol{D}_1\end{bmatrix}\boldsymbol{u}_1 \end{cases}$$

Compacting as a new system:

$$\begin{cases} \boldsymbol{\dot x}=\boldsymbol{A} \boldsymbol{x}+\boldsymbol{B} \boldsymbol{u} \\ \boldsymbol{y}=\boldsymbol{C} \boldsymbol{x}+\boldsymbol{D} \boldsymbol{u} \end{cases}$$

\begin{align} & \boldsymbol{A}=\begin{bmatrix} \boldsymbol{A}_1 & \boldsymbol{0}\\ \boldsymbol{B}_2\boldsymbol{C}_1 & \boldsymbol{A}_2 \end{bmatrix}\\ & \boldsymbol{B}=\begin{bmatrix} \boldsymbol{B}_1\\ \boldsymbol{B}_2\boldsymbol{D}_1 \end{bmatrix}\\ & \boldsymbol{C}=\begin{bmatrix}\boldsymbol{D}_2\boldsymbol{C}_1&\boldsymbol{C}_2\end{bmatrix} \\ & \boldsymbol{D}=\begin{bmatrix}\boldsymbol{D}_2\boldsymbol{D}_1\end{bmatrix} \end{align}

• Thanks for this answer. I have applied it as a MATLAB function for the purpose of cascading state space filters in case anyone who reads this is performing a similar task. – loudnoises May 19 '18 at 12:08
• @loudnoises, good job. As a special case, if the system is SISO, you can alternatively multiply the transfer functions in one line. – Arash May 19 '18 at 13:31
• I'm not sure I totally understand that, could you expand on what you mean by multiply the transfer functions in one line? – loudnoises May 19 '18 at 13:53
• @loudnoises, I do not have matlab on my laptop to check it but I roughly mean sys_cascade=ss(tf(sys1)*tf(sys2)); – Arash May 20 '18 at 11:40
• Oh right! Of course MATLAB will have in-built ways of doing these operations that will probably better than my method, I just like having code that isn't dependent on their system types. I use MATLAB Coder a lot and often their more advanced features won't compile so I need some homespun methods to get maximal performance. – loudnoises May 20 '18 at 13:38