# Using of matrices in simulink block diagrams

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

and they have block diagram structure like :

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:

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

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

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

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$$

• thanks for your help although I don't understand solution for conditions that parameters of matrices are state variables. can you explain more? – Rwy5 Jan 25 '18 at 19:56
• What do you want me to explain? You haven't defined your problem properly and you haven't taken the time to upvote. Where did you get the system you described above? – Voltage Spike Jan 25 '18 at 19:58

To perform matrix multiplication in simulation is as simple as using a gain block.

A gain block doesn't have to be a scalar, it can be a matrix.

• Thanks for your help, but my problem is the conditions, when elements of matrix are not scalar and they're variables such as the degree of pitching or rolling. what is your suggestion about this? – Rwy5 Jan 27 '18 at 16:22