Electronic – Using of matrices in simulink block diagrams

controlcontrol systemMATLABsimulationsimulink

All simulations I've done in simulink as yet have not matrix in their block diagram like the following picture :
enter image description here

and they have block diagram structure like :

enter image description here

for simulating a system that has matrices with variable parameters in matrice ,in its structrue, how can use matrices as block diagram in it?
for example for following system:

enter image description here

enter image description here

enter image description here

enter image description here

I can't set and adapt the dimesnsion of blocks.

Best Answer

If you want to build a block that has matrix operations there are to blocks that will let you do this, the Fcn block and the MATLAB function block, you can

enter image description here

You can carry through matrices with signals as shown below. The example shows a 1x3 vector multiplied by itself and displayed in the scope as a 3x3 matrix.

Care must be taken to ensure size is preserved for the matrix operation

enter image description here

But the math you have shown above does not make sense, as you should either be creating two states (for example \$x_4\$ should be split into two states) OR you should be carrying the \$x_4\$ through to simplify \$\dot{x_4}\$ to a scalar in your analysis of the system. Usually states are scalars at least with my experience with nonlinear control.

$$\left( \begin{bmatrix} u_2 \\ u_3 \end{bmatrix}+ \begin{bmatrix} \frac{-l K_4}{l_1} & 0 \\ 0 & \frac{-l K_4}{l_1} \end{bmatrix} \right) x_4 $$

Related Topic