MATLAB: What’s the difference in stateflow update method

stateflowupdate method

Hello all, I am using stateflow blocks to determine the state the system is in.
There are 1 repeating sequence source, 3 stateflow blocks and 1 scope.
The soure is designed to output sequence of 0 and 1, updating every second.
Below are the parameters of the source: Time values: [0 1 2 3 4 5] Output values: [0 1 1 1 0 0]
Start time is 0.0, stop time is 6.0, and the sample time is set to 1.0 second.
When it inputs value 0, it is supposed to output 0; and when it inputs value 1, it is supposed to output 1.
I chose different update method for the stateflow blocks, inherited, discrete and continous. And I get different results:
please see the image here.
Can somebody tell me why they are different? Thanks!!!!

Best Answer

Stateflow chart runs under simulink environment. Simulink invokes or triggers the blocks (in your case a stateflow chart) at particular sample times. Update method property of chart specifies how simulink invokes or trigger the stateflow chart and calculate its output.
See Stateflow Block Update Method for details description.
See Types of Sample Time to know more about discrete & continuous sample times.
To explore what Descrete & Continuous state means, see Simulink states, a good explanation in this thread, this blog and this blog.
Related Question