Skip to Main Content Skip to Search
Product Documentation

About Continuous-Time Modeling

What Is Continuous-Time Modeling?

Continuous-time modeling allows you to simulate hybrid systems that use mode logic — that is, systems that respond to both continuous and discrete mode changes. A simple example of this type of hybrid system is a bouncing ball. The ball moves continuously through the air until it hits the ground, at which point a mode change — or discontinuity — occurs. As a result, the ball changes direction and velocity due to a sudden loss of energy. A later exercise shows you how to model a bouncing ball in continuous time using a Stateflow chart (see Modeling a Bouncing Ball in Continuous Time).

When you configure Stateflow charts for continuous-time simulation, they interact with the Simulink solver in the same way as other continuous blocks, as follows:

When To Use Stateflow Charts for Continuous-Time Modeling

Use Stateflow charts for modeling hybrid systems with modal behavior — that is, systems that transition from one mode to another in response to physical events and conditions, where each mode is governed by continuous-time dynamics.

In Stateflow charts, you can represent mode logic succinctly and intuitively as a series of states, transitions, and flow graphs. You can also easily represent state information as continuous local variables with automatic access to time derivatives, as described in Purpose of Continuous-Time Variables.

If your continuous or hybrid system does not contain mode logic, consider using a Simulink model (see Modeling a Continuous System in the Simulink User's Guide).

Models That Demonstrate Continuous-Time Modeling

You can run the following continuous-time models with zero-crossing detection.

ModelDescription

Modeling a Rectifier with Zero Crossings

To open, click rectifier model

Rectifier takes a single (scalar) input and converts it to its absolute value. Illustrates how Stateflow charts register zero-crossing variables with Simulink models for accurate detection of mode changes.

Modeling a Bouncing Ball

To open, click bouncing ball model

Demonstrates how to model the dynamics of a bouncing ball by defining continuous-time state variables and their derivatives in Stateflow charts.

To try it yourself, see Modeling a Bouncing Ball in Continuous Time.

Modeling Newton's Cradle

To open, click Newton's Cradle model

Demonstrates how to model elastic collisions between balls in Newton's Cradle, a device that demonstrates conservation of momentum and energy. Uses vector assignment to continuous-time state variables.

Modeling a Clutch

To open, click clutch model

Implements the Simulink clutch demo model purely in a Stateflow chart. Represents the modal nature of the clutch using two states, Locked and Slipping.

Modeling the Opening Shot in Pool

To open, click pool model

Demonstrates how to model continuous systems that have a large number of discontinuous events, which rapidly (and unpredictably) change the dynamics.

To run these continuous-time models:

  1. At the MATLAB prompt, type:

    demo simulink stateflow
  2. In the Help browser, go to the section titled Continuous Time Modeling.

  3. Select the model of interest and follow the instructions.

  


Free Stateflow Interactive Kit

Learn how engineers use Stateflow to model state machines in their Simulink models.


Get free kit

Trials Available

Try the latest version of Stateflow.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS