Using Simulink    

Setting Breakpoints at Time Steps

To set a breakpoint at a time step, enter a time in the debugger's Break at time field (GUI mode) or enter the time using the tbreak command. This causes the debugger to stop the simulation at the beginning of the first time step that follows the specified time. For example, starting vdp in debug mode and entering the commands

causes the debugger to halt the simulation at the beginning of time step 9.0785 as indicated by the output of the continue command.

Breaking on Nonfinite Values

Selecting the debugger's NaN values option or entering the nanbreak command causes the simulation to stop when a computed value is infinite or outside the range of values that can be represented by the machine running the simulation. This option is useful for pinpointing computational errors in a Simulink model.

Breaking on Step-Size Limiting Steps

Selecting the Step size limited by state option or entering the xbreak command causes the debugger to stop the simulation when the model uses a variable-step solver and the solver encounters a state that limits the size of the steps that it can take. This command is useful in debugging models that appear to require an excessive number of simulation time steps to solve.

Breaking at Zero Crossings

Selecting the Zero crossings option or entering the zcbreak command causes the simulation to halt when Simulink detects a nonsampled zero crossing in a model that includes blocks where zero crossings can arise. After halting, Simulink prints the location in the model, the time, and the type (rising or falling) of the zero crossing. For example, setting a zero-crossing break at the start of execution of the zeroxing demo model,

and continuing the simulation

results in a rising zero-crossing break at

If a model does not include blocks capable of producing nonsampled zero crossings, the command prints a message advising you of this fact.


  Setting Breakpoints at Blocks Displaying Information About the Simulation