Main Content

Stair Generator

Discrete-time or continuous-time stair signal generator

Since R2020a

  • Stair Generator block

Libraries:
Simscape / Electrical / Control / General Control

Description

The Stair Generator block generates a stair signal based on the values specified in the Time (s) and Amplitude parameters.

The block can output a repeating stair pattern or execute the pattern only once by keeping the last amplitude active for all subsequent times.

Ports

Output

expand all

Stair signal, returned as a Simulink output signal.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Parameters

expand all

Main

Transition times at which the output changes to the value specified in the Amplitude parameter, in seconds. The value of this parameter must be strictly ascending.

Amplitudes of the stair signal at the time specified by the Time (s) parameter. This vector must have the same number of elements as the Time (s) parameter.

Time between consecutive block executions. During execution, the block produces outputs and, if appropriate, updates its internal state. For more information, see What Is Sample Time? and Specify Sample Time.

For inherited discrete-time operation, set this parameter to -1. For discrete-time operation, set this parameter to a positive integer. For continuous-time operation, set this parameter to 0.

If this block is in a masked subsystem or a variant subsystem that supports switching between continuous operation and discrete operation, promote this parameter to ensure correct switching between the continuous and discrete implementations of the block. For more information, see Promote Block Parameters on a Mask.

Whether to indefinitely repeat the stair pattern. If you select this parameter, the output repeats the stair pattern defined by the Time (s) and Amplitude parameters indefinitely.

If you clear this parameter, the output executes the stair pattern only once and then keeps the last amplitude active for all subsequent times.

Signal Attributes

Data type for the output. The type can be inherited, specified directly, or expressed as a data type object such as Simulink.NumericType.

When you select an inherited option, the block exhibits these behaviors:

  • Inherit: Inherit via internal rule — Simulink chooses a data type to balance numerical accuracy, performance, and generated code size, while taking into account the properties of the embedded target hardware. If you change the embedded target settings, the data type selected by the internal rule might change. It is not always possible for the software to optimize efficiency and numerical accuracy at the same time.

  • Inherit: Inherit via back propagation — Simulink automatically determines the output data type of the block during data type propagation (see Data Type Propagation). In this case, the block uses the data type of a downstream block or signal object.

  • Inherit: auto — Use a rule that inherits a data type.

For more information, see Control Data Types of Signals.

Programmatic Use

Block Parameter: OutDataTypeStr
Type: character vector
Values: 'Inherit: auto' | 'Inherit: Inherit via internal rule'| 'Inherit: Inherit via back propagation' | 'single' | 'double' | 'int8' | 'uint8' | 'int16' | 'uint16' | 'int32' | 'uint32'|'int64'|'uint64'| '<data type expression>'
Default: 'Inherit: Inherit via internal rule'

Version History

Introduced in R2020a