Quantcast

Stateflow

Simulating a Model and Analyzing the Results

You can analyze the behavior of your system by simulating your model. You can run what-if scenarios by restarting the simulation from any saved state and analyzing its reaction to different settings and configurations.

Simulating a Model

In Stateflow you can visualize system behavior during simulation by using state diagram animation to highlight the active states and transitions in your model.

Stateflow debugging capabilities let you step through the simulation in detail. You can set breakpoints, monitor data values, and step through different functions in your state diagrams. From the Stateflow debugger window, you can control the simulation execution and display the diagram's call stack and execution status.

Integrated Debugger 2:56
Step through a simulation and monitor data in a state diagram.

 

The Stateflow debugger detects run-time errors, including state inconsistencies, data range violations, and potential infinite loops.

Analyzing Results

During simulation you can visualize the simulation results by:

  • Viewing states and data with Simulink displays and scopes
  • Viewing logged data in the Simulation Data Inspector
  • Building custom displays with MATLAB

Alternatively, you can log diagram and state activity data for post-processing in MATLAB.

Simulation data visualization options in Stateflow: Simulink Data Inspector for comparing signals, a custom MATLAB interface for analyzing data, and the Simulink Signal Selector for comparing states.
Simulation data visualization options in Stateflow. Top left: Simulink Data Inspector for comparing specific signals; bottom left: custom MATLAB interface for analyzing data; right: Simulink Signal Selector for comparing specific states.
Next: Validating the Design and Generating Code

Try Stateflow

Get trial software

Connecting Simulink with Other Simulation Frameworks

View webinar

Learn to Create and Debug State Logic for Simulink Models

Get more info