Skip to Main Content Skip to Search
Product Documentation

Defining Continuous-Time Variables

Purpose of Continuous-Time Variables

To compute a continuous state, you must determine its rate of change, or derivative. You can represent this information using local variables that update in continuous time. In a Stateflow chart, continuous-time variables are always double type. You cannot change the type, but you can change the size.

Implicit Time Derivatives

For each continuous variable you define, a Stateflow chart implicitly creates a variable to represent its time derivative. A chart denotes time derivative variables as variable_name_dot. For example, the time derivative of continuous variable x is x_dot. You can write to the time derivative variable in the during action of a state. The time derivative variable does not appear in the Model Explorer.

Rules for Using Continuous-Time Variables

Follow these rules when defining and using continuous-time variables:

How to Define Continuous-Time Variables

To define continuous-time variables, follow these steps:

  1. Configure your chart to update in continuous time, as described in Configuring a Stateflow Chart to Update in Continuous Time.

  2. Add local data to your chart in the Stateflow Editor or Model Explorer.

  3. In the properties dialog box for your local data, set Update Method to Continuous.

    In this example, the chart automatically creates the variable mydata_dot to represent the time derivative of this data.

Exposing Continuous States to a Simulink Model

In a Stateflow chart, you represent continuous state using local variables, not inputs or outputs (see Purpose of Continuous-Time Variables). To expose the continuous states to a Simulink model, you must explicitly assign the local variables to Stateflow outputs in the during action of the state. For examples, see Modeling a Bouncing Ball in Continuous Time.

  


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