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 stepping back check box, and then click OK.

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

    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. A total of 25 forward steps produces these simulation results:

  6. You must step forward to create the simulation state that the step backward operation requires. This means you must first step forward before you can step backward through the same steps.

    In the Simulation toolbar, click the Step Back button four times to step backward to the simulation snapshot shown below.

Related Examples

More About

Was this topic helpful?