# How to get state-space equations form from a block diagram?

This is the block diagram that I'd like to transform into a state-space representation, where $$u_{1}$$ and $$u_{2}$$ are inputs and $$y_{1}$$ and $$y_{2}$$ are the outputs of the system

I tried to place state variables on the diagram and go from there (is there a cleaner way to do this?):

$$x_{1} = y_{1}$$

$$x_{2} = \dot{x}_{1}$$

$$x_{3} = \dot{x}_{2}$$

$$x_{4} = y_{2}$$

$$x_{5} = \dot{x}_{4}$$

$$x_{6} = \dot{x}_{5}$$

I am not sure how to go about from here. The $$\frac{1}{s+1}$$ block is confusing me. I know I can write the output signal from the $$\frac{1}{s+1}$$ block like this:

$$out_{1} = u_{1} - o\dot{u}t_{1}$$

$$out_{2} = u_{2} - o\dot{u}t_{2}$$

But I don't see if that's even useful and if it is, I don't know how to proceed.

This is one odd diagram. And you are frankly in the right direction. Now you only need to express each state as the equation from before in the diagram.

So lets start with $$x_1$$: \begin{aligned} x_1 &= \frac{1}{s+1}u_1 & \rightarrow x_1 &= u_1-\dot{x}_1 \\ x_2 &= x_1 - u_1 + u_2 & \rightarrow x_2 &= u_2 - \dot{x}_1 \\ \dot{x}_3 &= x_2 \\ \dot{x}_4 &= x_3 \end{aligned} And the other side: \begin{aligned} x_5 &= \frac{1}{s+1}u_2 &\rightarrow x_5 = u_2-\dot{x}_5 \\ x_6 &= x_5 + x_3 - x_7 \\ \dot{x}_7 &= x_6 \\ \dot{x}_8 &= x_7 \\ \end{aligned} And now substitute where ever needed to write everything as an equation of a state derivative: \begin{aligned} \dot{x}_1 &=u_1 - x_1 \\ \dot{x}_3 &= u_2 - u_1 - x_1 \\ \dot{x}_4 &= x_3 \\ \dot{x}_5 &= u_2-x_5 \\ \dot{x}_7 &= x_5 + x_3 - x_7 \\ \dot{x}_8 &= x_7 \\ \end{aligned} As there are 6 integrators, having 6 states does make sense. Despite that, I do think it can be simplified, but lets first implement it into a state space $$\dot{x} = \begin{bmatrix}-1 & 0 & 0 & 0 & 0 & 0 \\ -1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 &0 \\ 0 & 0 & 0 & -1 & 0 & 0 \\ 0 & 1 & 0 & 1 & -1 & 0 \\ 0 &0 &0&0&1&0\end{bmatrix}\begin{bmatrix}x_1 \\ x_3 \\ x_4 \\ x_5 \\ x_7 \\ x_8\end{bmatrix} + \begin{bmatrix}1 & 0 \\ -1 & 1 \\ 0&0 \\0&1\\0&0\\0&0\end{bmatrix}\begin{bmatrix}u_1 \\ u_2\end{bmatrix}$$

From this getting the C matrix is pretty self-explanatory. If there are any more questions, I am happy to hear.

• Thanks! Much appreciated Sep 2, 2021 at 18:45

What if on the bottom row the 1/s+1 and 1/s after the summation are swapped?

• If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review Apr 5, 2023 at 11:56

This system can be represented by 6-number of state variables. We do not need 8 states. Apparently the states x_2 and x_6 are not needed.