Stateflow Book
Stateflow Book
Stateflow Book
Steven T. Karris
Introduction to Stateflow withApplications to be a concise and easy-to-learn text. It provides complete, clear, and detailed explanations of the powerful interactive graphical design tool. All topics are illustrated with realworld examples.
This text includes the following chapters and appendices: The Stateflow Chart The Stateflow Truth Table Embedded MATLAB Functions in Stateflow Charts Model Coverage for Embedded MATLAB Functions Graphical Functions Connective Junctions History Junctions and Transitions Stateflow Boxes Mealy and Moore Charts in Stateflow Introduction to MATLAB Introduction to Simulink Masked Subsystems in Simulink Each chapter contains several practical applications.
Steven T. Karris is the president and founder of Orchard Publications. His undergraduate and graduate degrees are from Christian Brothers University, Memphis, Tennessee, and from Florida Institute of Technology, Melbourne, Florida. He is a registered professional engineer in California and Florida. He has over 30 years of professional engineering experience in industry. In addition, he has over 30 years of teaching experience as an adjunct professor at several educational institutions, the most recent at UC Berkeley, CA.
$69.95 U.S.A.
Preface
This text is an introduction to Stateflow , for use with Simulink and MATLAB . It can be considered as an continuation of Simulink and is written for students at the undergraduate and graduate programs, as well as for the working professional. Although some previous knowledge of MATLAB and Simulink would be helpful, it is not absolutely necessary; Appendix A of this text is an introduction to MATLAB, and Appendix B is an introduction to Simulink to enable the reader to begin learning MATLAB, Simulink, and Stateflow simultaneously, and to perform graphical computations and programming. Chapters 1 describes the basic workflow for building Stateflow charts that are used to model eventdriven 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 stepbystep procedures. Chapter 2 describes the basic workflow for building Stateflow truth tables to form decision making behavior, and how it works with Simulink blocks. We discuss the Truth Table block that can be added directly to a Simulink model, and the Truth Table that can be called from a Stateflow Chart block. Chapter 3 describes the procedure for adding Embedded MATLAB functions to Stateflow charts. It begins with an introduction to Embedded MATLAB functions using an example, followed by procedures for building a Simulink model with a Stateflow chart that calls the Embedded MATLAB function. It concludes with a procedure for debugging Embedded MATLAB functions in Stateflow Charts. Chapter 4 describes the procedure for adding Embedded MATLAB functions to Stateflow charts. It begins with an introduction to Embedded MATLAB functions using an example, followed by procedures for building a Simulink model with a Stateflow chart that calls the Embedded MATLAB function. Chapter 5 describes the procedure for creating graphical functions. It begins with an introduction to graphical functions followed by procedures for building a Simulink model to define graphical functions and includes illustrative examples. Chapter 6 describes the use of connective junctions to represent a decision point between alternate transition paths for a single transition. Flow diagram notation uses connective junctions to represent common code structures such as for loops and ifthenelse constructs without the use of states. Chapter 7 describes the use of history junctions to represent historical decision points in the Stateflow diagram. A description with an illustrative example is provided, and the chapter
concludes with a discussion on transitions. For easy reference, the examples presented are the same or similar to those included in the Stateflow documentation. Chapter 8 is a short chapter describing the use of boxes to extend Stateflow Chart diagrams. We describe how to create a state and changing it to a box, and how to create a box and change it to a state. Chapter 9, the last chapter, begins with an overview of the Mealy and Moore machines, then describes the procedure for creating Mealy and Moore charts in Stateflow, and concludes with illustrative examples for each. Appendix C presents an overview of masked subsystems, and a stepbystep procedure to create custom user interfaces, i.e., masks for Simulink subsystems. It is included in this text as a quick reference to masked subsystems in the Stateflow demos. This text is only an introduction to Stateflow, and the author feels that with the background gained after studying the material of this text, the reader should not have any difficulty going through the Stateflow demos which undoubtedly are realworld examples. This is the first edition of this title, and although every effort was made to correct possible typographical errors and erroneous references to figures and tables, some may have been overlooked. Accordingly, the author will appreciate it very much if any such errors are brought to his attention so that corrections can be made before the next printing. The author wishes to express his gratitude to the staff of The MathWorks, the developers of MATLAB and Simulink for the encouragement and unlimited support they have provided me with during the production of this text. Orchard Publications www.orchardpublications.com info@orchardpublications.com
11
Finite State Machines..............................................................................................11 EventDriven Systems.............................................................................................12 Construction of FiniteState Machines with Stateflow..........................................12 Procedure for Creating a Stateflow Chart .............................................................111 Summary ................................................................................................................170 Exercise for the Reader..........................................................................................178 Solution to the EndofChapter Exercise.............................................................179 21
Embedded MATLAB Functions in Stateflow Charts 3.1 3.2 3.3 3.4 3.5 3.6 3.7
Introduction to Embedded MATLAB Functions ....................................................31 Building the Model with a Stateflow Embedded MATLAB Function ...................32 Programming the Stateflow Chart with an Embedded MATLAB Function.........311 Simulation of the Matrix Operations Stateflow Chart ..........................................315 Summary ...............................................................................................................335 Exercises for the Reader........................................................................................340 Solution to the EndofChapter Exercises ...........................................................342 41
Model Coverage for Embedded MATLAB Functions 4.1 4.2 4.3 4.4
Introduction to Embedded MATLAB Functions ................................................... 41 Summary .............................................................................................................. 418 Exercises for the Reader....................................................................................... 419 Solution to the EndofChapter Exercises........................................................... 420 51
Graphical Functions
5.1 Introduction to Graphical Functions...................................................................... 51 5.2 Creating a Graphical Function............................................................................... 51 5.3 Subcharts .............................................................................................................. 510 5.4 Exporting Graphical Functions to Stateflow ........................................................ 517 5.5 Summary ............................................................................................................... 529 Introduction to Stateflowwith Applications Copyright Orchard Publications
5.6 Exercise for the Reader ......................................................................................... 531 5.7 Solution to the EndofChapter Exercise............................................................ 532
Connective Junctions 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8
61
The Stateflow Connective Junction Tool .............................................................. 61 Creating a Connective Junction ............................................................................ 62 Changing Connective Junction Size ...................................................................... 63 Changing Connective Junction Properties............................................................. 66 Uses of Connective Junctions ................................................................................ 67 Summary .............................................................................................................. 616 Exercise for the Reader ........................................................................................ 617 Solution to the EndofChapter Exercise ........................................................... 618 71
History Junctions and Transitions 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 7.10 7.11 7.12 7.13 7.14
History Junction Defined....................................................................................... 71 The Stateflow History Junction Tool .................................................................... 71 Changing the History Junction Size ...................................................................... 72 Changing History Junction Properties................................................................... 75 Entering a State ..................................................................................................... 79 Executing an Active State ................................................................................... 710 Exiting an Active State........................................................................................ 711 Execution Order for Parallel States ..................................................................... 713 Transitions ........................................................................................................... 715 Transition Connections ....................................................................................... 719 Inner Transitions ................................................................................................. 722 Summary .............................................................................................................. 725 Exercise for the Reader ........................................................................................ 727 Solution to the EndofChapter Exercise........................................................... 728 81
Creating a Box.......................................................................................................... 81 Changing a State to a Box ....................................................................................... 82 Using Boxes in Stateflow.......................................................................................... 84 Summary .................................................................................................................. 86
ii
91
9.1 Mealy Machine Defined...........................................................................................91 9.2 Moore Machine Defined ..........................................................................................93 9.3 Mealy and Moore Machines in Stateflow ................................................................94 9.4 Creating a Mealy Chart............................................................................................96 9.5 Creating a Moore Chart .........................................................................................910 9.6 Changing Chart Type.............................................................................................917 9.7 Debugging Mealy and Moore Charts .....................................................................917 9.8 Summary.................................................................................................................920 9.9 Exercises for the Reader .........................................................................................921 9.10 Solution to the EndofChapter Exercises............................................................922
Introduction to MATLAB A.1 A.2 A.3 A.4 A.5 A.6 A.7 A.8 A.9 A.10 A.11
A1
MATLAB and Simulink................................................................................A1 Command Window .............................................................................................A1 Roots of Polynomials ...........................................................................................A3 Polynomial Construction from Known Roots......................................................A4 Evaluation of a Polynomial at Specified Values ..................................................A6 Rational Polynomials ...........................................................................................A8 Using MATLAB to Make Plots .........................................................................A10 Subplots..............................................................................................................A18 Multiplication, Division, and Exponentiation ...................................................A18 Script and Function Files...................................................................................A26 Display Formats .................................................................................................A31 B1
B C
Simulink and its Relation to MATLAB ............................................................... B1 Simulink Demos ................................................................................................. B20 C1
Masks Defined ........................................................................................................ C1 Advantages Using Masked Subsystems.................................................................. C1 Mask Features......................................................................................................... C1 Creating a Masked Subsystem ................................................................................ C2 R1 IN1
References Index
iii
Chapter 1
The Stateflow Chart
his chapter describes the basic workflow for building Stateflow charts that are used to model eventdriven 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 stepbystep procedures.
Low
High
Off
Figure 1.1. State transition diagram for a typical finite state machine
11
The two dashed rectangles represent two independent modes of operation and are normally referred to as Parallel (AND) states, and the numbers 1 and 2 indicate the execution order. The solid rectangles within the parallel states 1 and 2 represent mutually exclusive modes of operation and are normally referred to as Exclusive (OR) states.
111
Step 7: Debugging the Stateflow Chart In Step (a) below we will illustrate a procedure for debugging a state inconsistency error, and in Step (b) a procedure for debugging data range violations. a. We save the model as Example_1_1_Debug in the same directory, we doubleclick the Transfer Controller to open the Stateflow chart, and we delete the default transitions to Overdraft Off and Savings Off states by selecting them and pressing the Delete key. We recall that there must be a default transition at every level of Stateflow hierarchy that has exclusive (OR) decomposition, and thus removing the default transition will cause a state inconsistency error. With both default transitions in state TransferOn, our Stateflow Editor window now appears as shown in Figure 1.71.
158
We open the Stateflow debugger by clicking the Debug tool to make sure that State Inconsistency is checked in the Error checking options panel as shown in Figure 1.72.
159
Figure 1.72. The Stateflow Debugging window for checking State Inconsistencies
We save the chart and then we build it by clicking the Build tool
in the Stateflow
Editor in Figure 1.71, and the window opens as shown in Figure 1.73 where we observe that Stateflow has generated two coder warnings indicated by gray bullets. These warnings indicate that two states identified by numbers #21and #22 have no unconditional path to a substate and that the sources of the problems are Overdraft and Savings. To locate the offending states, in the Stateflow Builder in Figure 1.73 we doubleclick the coder warnings text or we can click the link to the state numbers in the status panel at the bottom of the Stateflow Builder dialog box in Figure 1.73. Thus, if we doubleclick #21, Stateflow highlights the Overdraft state in the Stateflow Editor chart as shown in Figure 1.74. Likewise, if we doubleclick #22, Stateflow highlights the Savings state in the Stateflow Editor chart. We add the default transitions to the Overdraft state and to the Savings state in the Stateflow Editor chart, we build the chart again, and we observe that the chart builds successfully without parser or code generation errors as shown in Figure 1.75.
160
As we continue clicking the Continue button repeatedly, eventually the status panel at the upper part of the Stateflow Debugger window indicates Simulink Time: 50.000000. At this time the SWITCH signal from the Function Builder block returns to 0 and the AddShiftOff state becomes active while the AddShiftOn state becomes inactive as shown below.
1120
Chapter 2
The Stateflow Truth Table
his chapter describes the basic workflow for building Stateflow truth tables to form decisionmaking behavior, and how it works with Simulink blocks. We discuss the Truth Table block that can be added directly to a Simulink model, and the Truth Table that can be called from a Stateflow Chart block.
DN
t=2 t=3 t=4 ....... The table above implements the function
t = ttable ( A, B, C, D )
In Table 2.1 above, each of the conditions entered in the Condition column must evaluate to true (nonzero value) or false (zero value). Outcomes for each condition are specified as T (true), Introduction to Stateflowwith Applications Copyright Orchard Publications
21
Figure 2.7. The contents of the Condition Table for Example 2.1
In the Condition Table of Figure 2.7 above, each decision column D1 through D11 forms a group of decision outcomes with the logical AND relationship into a decision. The False (F)* and True (T) entries in decision columns D1 through D10 are in agreement with the generic table, Table 2.2. The last decision column, D11, is referred to as the default decision column for the truth table, and covers any remaining decisions not listed in decision columns D1 through D10. All entries in the default decision column must be indicated with the dash () character and it represents a true or false condition, i.e., a dont care condition. The default decision column must always be the last decision column.
We can press the space bar to toggle through the possible values F, , and T. We can also enter these by typing them. Any other characters are rejected.
28
Figure 2.8. The contents of the Action Table for Example 2.1
From the dec2BCDtt1/Truth Table window of Figure 2.7 or Figure 2.8, we click on Edit Data/Ports from the Add drop menu, and the Ports and Data Manager window appears as shown in Figure 2.9.
29
We check the validity of this model with the Manual Switch block configured as shown above, and specifying the simulation time as 0, 1, .... 9.
274
2. We repeat step (g).1 above for the Truth Table Editor toolbar of ttable2, and again we are told that no errors were found. 3. In the MATLAB Command window, we enter the values X=0; Y=0; Cin=0; 4. We return to the Simulink model, we issue the simulation command, and our Simulink model now is as shown below. We save the model as FullAdder.
5. We continue stepping through the simulation by changing the values of X, Y, and Cin in accordance with the generic truth table of the Full adder to verify that the model outputs the correct values for the Sum and Cout outputs.
290
7. The waveforms of the Pulse Generator blocks and the waveforms for Sum and Cout are shown below.
291
292
Chapter 3
Embedded MATLAB Functions in Stateflow Charts
his chapter describes the procedure for adding Embedded MATLAB functions to Stateflow charts. It begins with an introduction to Embedded MATLAB functions using an example, followed by procedures for building a Simulink model with a Stateflow chart that calls the Embedded MATLAB function. It concludes with a procedure for debugging Embedded MATLAB functions in Stateflow Charts.
Figure 3.1. Example of a Simulink model with a Stateflow Chart that contains an Embedded MATLAB function
31
Our model is now complete and it is shown in Figure 3.18 where we have named the Stateflow Chart block Matrix Operations, and we have stretched the Display 2 block to accommodate the nine elements of the inverse matrix after the simulation command is issued. The value of the determinant will provide us with an indication whether the given matrix is well-behaved or is an ill-conditioned matrix.* We save the model and we will simulate it in the next section.
Figure 3.18. The completed model for Example 3.1 prior to execution of the simulation command.
* This topic is discussed in Numerical Analysis Using MATLAB and Excel, ISBN-13: 978-1-934404-03-4
315
Figure 3.25. The Stateflow Editor, the Scope block, and the Stateflow Debugging windows for data observation
In the Stateflow Debugger window in Figure 3.25, we begin simulation by clicking the Start button. We observe that Stateflow displays a Block Error message for the Constant block as indicated in Figure 3.26. This is because we failed to define the elements of the matrix A in the MATLAB Command Window before starting the simulation. Therefore, we open the MATLAB Command Window and we enter the elements of matrix A as
A=[3 2 0; 1 4 7; 5 8 6];
In the Stateflow Debugger window in Figure 3.25 we click again the Start button and we observe that it is changed to a Continue button as shown in Figure 3.27. We also observe that the Browse Data field is now active, in the model window in Figure 3.28 the Display blocks have been filled with zeros, and the Start command button has been replaced with the Stop button and the Pause button . Introduction to Stateflowwith Applications Copyright Orchard Publications
321
Figure 3.28. The Simulink model of Example 3.1 at the start of simulation
We can also view this value in the MATLAB Command window by pressing the Enter key at the command prompt and MATLAB displays
debug>>
and at the command prompt we type det and MATLAB displays the value of the determinant at the start of the simulation. det = 0 To see the value of the inverse of the matrix, at the MATLAB Command Window we type inv and MATLAB displays inv = 0 0 0 0 0 0 0 0 0
323
Chapter 4
Model Coverage for Embedded MATLAB Functions
his chapter describes the procedure for adding Embedded MATLAB functions to Stateflow charts. It begins with an introduction to Embedded MATLAB functions using an example, followed by procedures for building a Simulink model with a Stateflow chart that calls the Embedded MATLAB function.
Figure 4.1. Example with a Stateflow Chart that contains a Model Coverage for Embedded MATLAB function
41
Chapter 5
Graphical Functions
his chapter describes the procedure for creating graphical functions. It begins with an introduction to graphical functions followed by procedures for building a Simulink model to define graphical functions and includes illustrative examples.
and the Stateflow Editor window now appears as shown in Figure 5.2. 3. We click the Model Explorer icon at the top toolbar of the Stateflow Editor window and this function now appears in the Model Explorer window shown in Figure 5.3.
51
Figure 5.7. The Stateflow Chart Editor with the graphical function
Next we click the Model Explorer tool and the Model Explorer window appears as shown in Figure 5.8 where with the Chart highlighted in the Model Hierarchy pane (left), the Contents pane (right) shows the function arguments Rin , X L , and X C as inputs, and the return value
Zout as the output.
56
The plot above reveals that one root is at x = 0 , and this can be easily verified by inspection of the given function. The second root is near the vicinity x = 1.3 , and the third near the vicinity x = 2.2 . Following the procedure of Example 5.2, we begin by typing sfnew at the MATLAB command prompt and in the model that appears we add a Constant block from the Commonly Used Blocks Library, two Reshape blocks from the Math Operations Library, and two Display blocks from the Sinks Library. Our model is as shown below.
532
In the flow diagram above, the transition A to B occurs if state A is active, if event e_one occurs, and [c_one] is true. The transition A to C occurs if state A is active, if event e_one occurs, and [c_two] is true. The transition A to D occurs if state A is active and event e_one occurs. Since we did not specify [c_three], the transition condition is not [c_one] and not [c_two]. Example 6.3 This is a connective junction example with a selfloop. In some situations, the transition event occurs but a condition is not met. No transition is taken, but an action is generated. We can represent this situation by using a connective junction or a selfloop transition (transition from state to itself). Let us consider the flow diagram notations in Figure 6.12.
In the flow diagram on the left, if state A is active when event e occurs and the condition [c1] is met, the transition from state A to state B occurs, and generates action a1. The transition from state A to state A is valid if event e occurs and [c1] is not true. In this selfloop transition, the system exits and reenters state A, and executes action a2. In the equivalent representation on the right, the use of a connective junction makes it unnecessary to specify the implied condition [~c1] explicitly.
610
This flow diagram shows a combination of flow diagram notation and state transition notation. Selfloop transitions to connective junctions can be used to represent for loop constructs. In state A, event e occurs. The transition from state A to state B is valid if the conditions along the transition path are true. The first segment of the transition does not have a condition, but does have a condition action {i=0}, and this condition action is executed. The condition on the selfloop transition is evaluated as true and the condition actions {i++;func1()} execute. The condition actions execute until the condition [i<10] is false. The condition actions on both the first segment and the selfloop transition to the connective junction effectively execute a for loop (for i values 0 to 9 execute func1()). The for loop is executed outside the context of a state. The remainder of the path is evaluated. Because there are no conditions, the transition completes at the destination, state B. Example 6.5 This is a flow diagram notation example. Let us consider the flow diagram notations in Figure 6.14.
611
Chapter 7
History Junctions and Transitions
his chapter describes the use of history junctions to represent historical decision points in the Stateflow diagram. A description with an illustrative example is provided, and the chapter concludes with a discussion on transitions. For easy reference, the examples presented are the same or similar to those included in the Stateflow documentation.
To create a history junction, we do the following: 1. In the diagram toolbar, we click the History Junction tool .
2. We move the cursor into the diagram editor.The cursor takes on the shape of a history junction as shown in Figure 7.2. We click to place a connective junction in the desired location in the drawing area.
* We recall from Chapter 1 that objects in Stateflow exist in a hierarchy and states can contain other states referred to as substates, and can be contained by other states referred to as superstates.
71
Chapter 9
Mealy and Moore Charts in Stateflow
his chapter begins with an overview of the Mealy and Moore machines, then describes the procedure for creating Mealy and Moore charts in Stateflow, and concludes with illustrative examples for each.
Input x 0 1 0 1 0 1 0 1 Q1
Next State
n+1
Output y 0 1 0 1 0 1 0 1
Q0 0 0 1 1 0 0 1 1
Q0
n+1
0 1 1 0 1 0 0 1
1 1 0 0 1 1 0 0
We can represent the state table above with the timing diagram shown in Figure 9.1 below.
91
CP
x
Q0 Q1 Q0 Q1
n+1 n n
0 0 0 0 1 0 0
1 0 0 1 1 1
0 1 0 0 1 0
1 1 0 0 0 1
0 0 1 1 1 0
1 0 1 1 0 1
0 1 1 0 0 0
1 1 1 0 1 1
0 0 0 0 0 0
n+1
The Mealy machine for the state table in Table 9.1 and timing diagram in Figure 9.1 is shown in Figure 9.2 below.
00
11
01
10
Figure 9.2. The Mealy machine for Example 9.1
In the state diagram in Figure 9.2, the numbers inside the states represented by the circles are the four states of a synchronous counter that counts clockwise from 00 to 01 to 10 to 11 to 00 and repeats whenever the input signal x is 0 , and counts counterclockwise from 11 to 10 to 01 to 00 to 11 and repeats whenever the input signal x is 1 .
92
00 01
11 00
01 10
10 11
93
Appendix C
Masked Subsystems
his appendix presents an overview of masked subsystems, and a stepbystep procedure to create custom user interfaces, i.e., masks for Simulink subsystems.
C1
Figure C.9. The Function Block Parameters window with the values of the constants
With the variables defined as above, the masked subsystem implements the quadratic equation
y = x 5x + 6
2
and the roots of this equation are x 1 = 2 and x 2 = 3 . Our model is tested for the first root as shown in Figure C.10.
Figure C.10.
The Mask Editor also contains the Initialization tab that allows us to enter MATLAB commands that initialize the masked subsystem, and the Documentation tab that lets us define or modify the type description and help text for a masked subsystem. These tabs are shown in Figures C.11 and C.12, and are not used in this example. Introduction to Stateflow with Applications Copyright Orchard Publications
C9
Index
Symbols % (percent) symbol in MATLAB A-2 A abs(z) in MATLAB A-23 action 1-1 action table 2-1 actions 2-1 algebraic constrain blocks in Simulink B-18 All Data (Current Chart) in Simulink 3-22 angle(z) in MATLAB A-23 animation in Simulink 3-16 animation delay 1-55 animation of Stateflow charts 1-47 autoscale icon in Simulink B-12 axis in MATLAB A-16 B backtracking behavior 6-14 block error 1-67 blocking 3-40 box in Stateflow 8-1 box in MATLAB A-12 box tool in Stateflow 8-1 breakpoints 1-49, 3-19 Browse Data 1-50, 3-19 Build tool 1-60 C E changing a box to a state 8-1 changing a state to a box 8-1 Chart Entry 1-49, 3-19 Chart Entry 3-19 Classic Machine in Stateflow 9-4 clc in MATLAB A-2 clear in MATLAB A-2 code generation errors 1-60 Coder Options 1-48, 3-18 column vector A-19 command screen in MATLAB A-1 Command Window in MATLAB A-1 commas in MATLAB A-8 comment line in MATLAB A-2 Commonly Used Blocks in Simulink B-7 complex conjugate A-4 complex numbers in MATLAB A-3 condition 1-2, 1-14, 7-18 condition action 7-18 condition table 2-1 conditions 2-1 configuration parameters 1-46, 3-15, B-12 Connective Junction 6-1 Contents pane 3-6, B-7 Continue button 1-56, 3-21 Continue Debugging 3-33 conv in MATLAB A-6 Creating a Mealy Chart 9-6 Creating a Moore Chart 9-10 Editor window in MATLAB A-1 Editor/Debugger in MATLAB A-1 electric field strength example 3-40 element-by-element division and exponentiation in MATLAB A-21 element-by-element multiplication in MATLAB A-18, A-20 eM functions 3-4 Embedded MATLAB Editor 3-7 Embedded MATLAB function 3-1 Embedded MATLAB Function tool 3-3 Entering a State 7-9 entry action 1-1, 1-14 eps in MATLAB A-22 Erlang 3-40 Erlang B 3-40 Erlang B model 3-41 Erlang C 3-40 Erlang C model 3-41 error checking options 1-59 event 1-2, 1-14, 7-17 event driven systems 1-2 event properties dialog box 1-44 event trigger 7-17 exclusive (OR) state 1-12 executing an Active State 7-10 execution order 1-12, 1-27 execution Order for Parallel States 7-13 history junction 7-1 History Junction tool 7-1 I If 4-18 if-then-else 6-13 imag(z) in MATLAB A-23 implicit ordering 1-29 increments between points in MATLAB A-14 inner transition 7-22 input argument 3-6 L Launch Model Explorer tool 1-68 lims = in MATLAB A-27 linspace in MATLAB A-14 local data 9-7 log in MATLAB A-13 log(x) A-13 log10(x) in MATLAB A-13 log2(x) in MATLAB A-13 loglog in MATLAB A-13 loglog(x,y) in MATLAB A-13 M mask C-1 IN1 D data icon 3-6 data points in MATLAB A-14 data range 1-64 data range violation 1-58 Debug tool 1-48, 3-18 decibels A-13 decision 2-1, 2-2 decision columns 2-1, 2-2 decision coverage 4-2 decomposition 1-26 deconv in MATLAB A-6 default A-12 default color A-15 default decision 2-2 default decision column 2-8 default line in MATLAB A-15 default marker in MATLAB A-15 default transition 1-14, 7-16 default transition 7-16 Default Transition tool 1-37, 3-4 default transitions 1-37 delay 3-18 demo in MATLAB A-2 description 2-1 Disable all field 3-24 Display block in Simulink B-18 display formats in MATLAB A-31 dot multiplication operator in MATLAB A-20 during action 1-14 exit in MATLAB A-2 exit action 1-1 exiting an Active State 7-11 explicit ordering 1-29 explicit ordering of parallel states 7-14 exporting graphical functions to Stateflow 5-17 F figure window in MATLAB A-13 finite state machine 1-10 Flip Block command in Simulink B-11 for 4-18 for loops 6-11 format A-31 fplot in MATLAB A-27 function block parameters B-10 function file in MATLAB A-26 function header 4-18 fzero in MATLAB A-26 G Gain block in Simulink B-18 graphical functions 5-1 graphical tool function 5-1 grid in MATLAB A-12 gtext in MATLAB A-13 guarding a transition 1-39 H
Mask Editor C-1 mask icon C-1 mask parameters C-1 masked subsystem 1-8, C-1 Math Operations B-11 MATLAB Demos A-2 MATLABs Editor/Debugger A-1 matrix multiplication in MATLAB A-19 Mealy machine 9-1 Mealy machines in Stateflow 9-4 mesh(x,y,z) in MATLAB A-17 meshgrid(x,y) in MATLAB A-17 m-file in MATLAB A-1, A-26 Model Coverage for an Embedded MATLAB function 4-1 Model Explorer 3-5 Model Explorer tool 5-6 Model Hierarchy pane 3-6 Modified Condition Decision Coverage 4-18 Moore machine 9-3 Moore machines in Stateflow 9-4 multiple connective junctions 6-2 N NaN in MATLAB A-26 O observer state 1-28 order of execution 1-27 output argument 3-6 P Parallel (AND) state 1-12 parser errors 1-60 Pause button 3-21 plot in MATLAB A-10, A-15 plot3 in MATLAB A-15 Poisson 3-40 Poisson model 3-41 polar plot in MATLAB A-23, A-24 poly in MATLAB A-4 polyder in MATLAB A-7 Polynomial construction from known roots in MATLAB A-4 polyval in MATLAB A-6 power density example 3-40 progress bar in Simulink 3-24 Q quit in MATLAB A-2 R real(z) in MATLAB A-23 roots in MATLAB A-3 roots of polynomials in MATLAB A-3 round(n) in MATLAB A-24 row vector in MATLAB A-3, A-19 running Simulink B-7 run-time activities 3-19
S Scope block in Simulink B-12 script file in MATLAB A-26 semantics 9-7 semicolons in MATLAB A-8 semilogx in MATLAB A-12 semilogy in MATLAB A-12 sfprj 1-50 sfprj 3-20 sfun 1-48 sfun 3-18 signature label 2-17 signature return values 3-45 simout To Workspace block B-13 simulation diagnostics 1-66 Simulation drop menu B-12 simulation start icon B-12 Simulation Target 1-47, 3-16 Simulink icon B-7 Simulink Library Browser B-8 Sinks library B-18 Start button 3-21 Start command button 3-21 Start simulation B-12 Start Simulation tool 3-27 state 1-1 state action 1-14 state entry 1-49 state inconsistency error 1-58 State tool 1-24 Stateflow Builder 1-60 Stateflow Debugging 1-48 Stateflow Debugging 3-18 Stateflow Editor 1-24 Stateflow Editor chart 1-12 Stateflow Target Builder 3-16 State-Space block B-12 Step In tool 3-27 Step Out tool 3-30 Step tool 3-27 Stop button 3-21 string in MATLAB A-16 subchart 5-10 subcharted state 5-10 subplot(m,n,p) in MATLAB A-18 switch 4-18 T Target Builder 1-48, 3-18 text A-14 title(string) in MATLAB A-12 Traffic Light example with a Moore state machine 9-14 transition action 1-1, 7-18 transition connections 7-19 transitions 7-15 Tree Pane B-7 trigger port 1-42 Truth Table block 2-1
U User specified state/transition execution order 1-30 using boxes in Stateflow 8-1 V valid transitions 7-18 Vending Machine example with a Mealy state machine 9-8 W while 4-18 X xlabel in MATLAB A-12 Y ylabel in MATLAB A-12
IN2