Step Through a Simulation

Step Forward and Back

This example shows how to step forward and back through a simulation.

  1. At the MATLAB® prompt, type

  2. In the Simulink® Editor for the vdp model, click to open the Simulation Stepping Options dialog box.

  3. In the dialog box, select the Enable previous stepping check box, and then click OK.

  4. In the Simulation toolbar, click the Step Forward button .

    The simulation simulates one step, and the software stores a simulation snapshot for that step.

  5. Click the Step Forward button again to step forward again and store simulation data. When you view the results of the simulation, 25 clicks plots this data:

  6. In the Simulation toolbar, click the Step Back button one or more times to step backward to the simulation snapshot of the previous step.

    You must step forward before you can step backward to create the simulation state that the step backward operation requires.

    The scope updates to reflect the step back.

Related Examples

More About

Was this topic helpful?