Mealy, Moore, and Continuous-Time Charts

Implement domain-specific semantics

Select the continuous update method for models that respond to both continuous and discrete mode changes. Use Mealy charts to model finite state machines whose output is a function of current input and the current state. Use Moore charts to model finite state machines whose output depend on only the current state.

Topics

Continuous-Time Systems

Continuous-Time Modeling in Stateflow

Simulate systems that exhibit modal behavior in continuous time.

Store Continuous State Information in Local Variables

Define continuous-time variables and their derivatives.

Model a Bouncing Ball in Continuous Time

Simulate a hybrid system that responds to continuous and discrete mode changes.

Model a DC Motor in Stateflow

Use continuous-time semantics to model a permanent magnet DC motor.

Model the Dynamics of Moving Billiard Balls

This example shows how to model the opening shot in a billiards game by using continuous-time matrix variables.

Mealy and Moore Charts

Overview of Mealy and Moore Machines

Create charts that implement Mealy and Moore state machine semantics.

Design Considerations for Mealy Charts

Use best practices for implementing Mealy semantics in charts.

Model a Vending Machine by Using Mealy Semantics

Use Mealy machine semantics to design a vending machine.

Design Considerations for Moore Charts

Use best practices for implementing Moore semantics in charts.

Model a Traffic Light by Using Moore Semantics

Use Moore machine semantics to design a traffic light controller.

Convert Charts Between Mealy and Moore Semantics

Achieve equivalent chart behavior when you change state machine types.

Initialize Persistent Variables in MATLAB Functions

Specialized semantics impact the way that a function initializes persistent data.

Featured Examples