# Guy and Seth on Simulink

## Running a Simulation Step by Step

As you probably know, when you simulate a model, there is a lot of stuff going on that you do not see.

Yesterday I showed a user how to visualize the execution of a simulation step by step using the Simulink Debugger and he was very impressed. Let's take a look at the debugger animation.

If you are interested in seeing every method executed by the Simulink engine during the simulation, start the Simulink Debugger from the Tools menu. Then click on the Animation Mode button and start your simulation.

What are all those methods?

The documentation for the Debug Pointer gives a description of the rectangular patches displayed on the blocks and the meaning of their color.

If you are interested to learn more about all those steps taken by the Simulink engine, I recommend going through the documentation page How the Simulink Engine Interacts with C S-Functions.

This documentation will show you in which order those methods are executing and you will find a link describing each of them. S-functions provide all the methods used by Simulink to simulate a model, so if you understand how S-functions work, you will understand how Simulink works.

What's Next?

What I showed today is only one of the many feature of the Simulink Debugger. If you are interested in learning more about what the Simulink Debugger can do for you, let me know by leaving a comment here.

Now you can cancel your cabel/satelite subscription! Open your favorite model, get a cold beer, some snacks, and sit back to enjoy the Simulink Debugger Animation! (Can you tell it is Friday?)

### 5 Responses to “Running a Simulation Step by Step”

1. Eike Petersen replied on :

Would be nice if you could show some more features of the debugger. I think there are lots of people (including me) who have no idea about what you can do with it.

Kind Regards,

Eike

2. Thomas Marullo replied on :

I also would like to see a much more detailed usage of tracing through a model to debug specific outputs.

3. Abhishek replied on :

I agree with the above comments. A long video giving detailed explanation with examples of debugging will help out hundreds of frustrated grad students (like me).

4. Nathan Fitzgerald replied on :

Did the debugger change in 2012b? It looks like it’s now located under Simulation->Debug->Debug Model, but I don’t see the animate buttons anywhere on the debugger window.

5. Guy Rouleau replied on :

@Nathan: You are correct. In R2012b, the animation is not available in the Simulink debugger. If find this very infortunate, but we are looking on something better for a future release.

The following capabilities are not available in the debugger:

- Animations
- Adding breakpoints while in the initialization phase
- Displaying I/O while in the initialization phase

 Name (required) E-mail (required, will not be published) Website (optional) Spam protection (required): What is 1 + 4 ?

Wrap code fragments inside <pre> tags, like this:

<pre class="code">
a = magic(3);
sum(a)
</pre>


If you have a "<" character in your code, either follow it with a space or replace it with "&lt;" (including the semicolon).

Guy Rouleau and Seth Popinchalk are Application Engineers for MathWorks. They write here about Simulink and other MathWorks tools used in Model-Based Design.

These postings are the author's and don't necessarily represent the opinions of MathWorks.