| Stateflow User's Guide |
 |
Ways That You Can Use Stateflow
Here are a few of the ways that you can use Stateflow diagrams in your Simulink models.
- Simulate plant control. -- The primary use of Stateflow is to simulate the control of control objects in a physical plant. For example, an automobile engine needs a fan to blow air through a radiator to cool water for cooling an engine. You model the engine with Simulink. You add a Stateflow block to monitor engine temperature and activate the fan and water pump for the engine.
- Choose state equations for simulation. -- In models that simulate complex behavior based on complex physical relationships, you might need to change the equations that you use in response to plant circumstances. For example, if you are using Simulink to model materials during a collision, you might want to add a Stateflow block to change the equations of state depending on current values for stress, strain, and deformation.
- Program complex logic visually. -- You can use Stateflow as a visual programming environment with flow diagrams that use only junctions and transitions. For example, the following Stateflow diagram performs the equivalent of a set of cascading
if-then statements:

During simulation of your model, you can animate your visual programs and watch them execute. You can slow down execution or place breakpoints at different points in the program to examine outcomes, such as the value of data variables.
Here are some types of applications that benefit directly from the use of Stateflow:
- Embedded systems
- Avionics (planes)
- Automotive (cars)
- Telecommunications (for example, routing algorithms)
- Commercial (computer peripherals, appliances, and so on)
- Programmable logic controllers (PLCs) (process control)
- Industrial (machinery)
- Man-machine interface (MMI)
- Graphical user interface (GUI)
- Hybrid systems
- Air traffic control systems (digital signal processing [DSP] + control + MMI)
Demonstration examples have already been created for several of these application types. Once you learn Stateflow, be sure to examine the Stateflow demo models. See Where to Go from Here for instructions on accessing the Stateflow demo models.
| Custom Targets | | Before You Get Started |  |
© 1994-2005 The MathWorks, Inc.