| Simulink Reference | ![]() |
Switch output between two constants
Library
Description
The Relay block allows its output to switch between two specified values. When the relay is on, it remains on until the input drops below the value of the Switch off point parameter. When the relay is off, it remains off until the input exceeds the value of the Switch on point parameter. The block accepts one input and generates one output.
The Switch on point value must be greater than or equal to the Switch off point. Specifying a Switch on point value greater than the Switch off point value models hysteresis, whereas specifying equal values models a switch with a threshold at that value.
Data Type Support
The Relay block accepts real or complex signals of any data type supported by Simulink, except Boolean. The Relay block supports fixed-point data types.
For a discussion on the data types supported by Simulink, refer to Data Types Supported by Simulink in the Using Simulink documentation.
Parameters and Dialog Box
The Main pane of the Relay block dialog appears as follows:
-1. See Specifying Sample Time in the online documentation for more information.
The Signal data types pane of the Relay block dialog appears as follows:
Specify via dialog, the Output data type, Output scaling value, and Parameter Scaling parameters become visible.
Specify via dialog for the Output data type mode parameter.
Specify via dialog for the Output data type mode parameter, and is only enabled if you select Use specified scaling for the Parameter Scaling parameter.
Use Specified Scaling--This mode allows you to specify the output scaling in the Output scaling value parameter
Best Precision: Vector-wise--This mode produces a common binary point for each element of the output vector based on the best precision for the largest value of the vector.
This parameter is only visible if you select Specify via dialog for the Output data type mode parameter.
Characteristics
| Direct Feedthrough |
Yes |
| Sample Time |
Specified in the Sample time parameter |
| Scalar Expansion |
Yes |
| Dimensionalized |
Yes |
| Zero Crossing |
Yes, if enabled. |
| Relational Operator | Repeating Sequence | ![]() |
© 1994-2005 The MathWorks, Inc.