Introduction to Stateflow with Applications

This chapter describes the basic workflow for building Stateflow charts that are used to model event driven systems, and how they work with Simulink blocks. It begins with definitions that are essential in understanding Stateflow and its relation to Simulink and MATLAB. It continues with the description of a demo model provided by The MathWorks , and concludes with an example with step by step procedures.
A finite state machine is a model describing the behavior of a finite number of states, the transitions between those states, and actions.
A state represents an operating mode of a machine, for instance, a typical household portable space heater has four states, off, low, medium, and high.The on state is omitted because the machine (space heater) must be on to operate in the low, medium, and high states.
An action describes the activity that is to be performed. An action can be further classified as an entry action which is performed when entering the state, an exit action which is performed when exiting the state, and as a transition action which is performed during a transition.
A finite state machine can be represented either by a state diagram or a state transition table. Thus, a typical household space heater can be represented as shown in Figure 1.1, or as a state transition table shown as Table 1.1.