Question

I believe that it is possible to transfer MATLAB codes to Simulink. When we program in MATLAB, I know that it will execute from top to bottom line by line. On the other hand, Simulink deals with blocks that are connected to each others. There might be feedback signals. There might be subsystems whose outputs are inputs to other blocks and so on...Suppose we have 3 subsystem blocks connected to each other and the last block's output is fed into the first, which block does Simulink start with?

My question might be a foolish one especially after this long of playing with MATLAB and Simulink but I've not come to know the answer for this yet!

Was it helpful?

Solution

This depends on the actual simulation model. Before the simulation starts, Simulink analyzes the model (which blocks are connected in which direction, are there algebraic loops, etc.). The result is the so-called sorted order of the blocks, which is then used to actually execute the blocks' code.

See the documentation for details.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top