Relational Operator - Perform specified relational operation on inputs

Library

Logic and Bit Operations

Description

The Relational Operator block performs the specified comparison of its two inputs.

You select the relational operator connecting the two inputs with the Relational Operator parameter. The block updates to display the selected operator. The supported operations are given below. In each case, the first input corresponds to the top input port and the second input to the bottom input port. (See Changing the Orientation of a Block in the Simulink® documentation for a description of the port order for various block orientations.)

OperationDescription

==

TRUE if the first input is equal to the second input

~=

TRUE if the first input is not equal to the second input

<

TRUE if the first input is less than the second input

<=

TRUE if the first input is less than or equal to the second input

>=

TRUE if the first input is greater than or equal to the second input

>

TRUE if the first input is greater than the second input

You can specify inputs as scalars, arrays, or a combination of a scalar and an array:

The input with the smaller positive range is converted to the data type of the other input offline using round-to-nearest and saturation. This conversion is performed prior to comparison.

The output data type is specified with the Output data type parameter. The output equals 1 for TRUE and 0 for FALSE.

Data Type Support

The Relational Operator block accepts real or complex signals of any data type supported by Simulink software, including fixed-point data types. One input can be real and the other complex if the operator is == or !=.

For a discussion on the data types supported by Simulink software, see Data Types Supported by Simulink® in the Simulink documentation.

Parameters and Dialog Box

The Main pane of the Relational Operator block appears as follows:

Relational operator

Designate the relational operator used to compare the two inputs.

Enable zero crossing detection

Select to enable zero crossing detection. For more information, see Zero-Crossing Detection .

Sample time (-1 for inherited)

Specify the time interval between samples. To inherit the sample time, set this parameter to -1. See Specifying Sample Time in the online documentation for more information.

The Signal Attributes pane of the Relational Operator block appears as follows:

Require all inputs to have the same data type

Select to require inputs to have the same data type.

Output data type

Specify the output data type. You can set it to:

OptionDescription
booleanSpecifies the output data type as boolean.
Inherit: Logical

Use the Implement logic signals as boolean data model configuration parameter (see Implement logic signals as boolean data (vs. double)) to specify the output data type.

    Note   This option is intended to support models created before the boolean option became available. Use one of the other options, preferably boolean, for new models.

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Output data type parameter.

See Specifying Block Output Data Types for more information.

Characteristics

Direct Feedthrough

Yes

Sample Time

Specified in the Sample time parameter

Scalar Expansion

Yes, of inputs

Dimensionalized

Yes

Multidimensionalized

Yes

Zero Crossing

Yes, if enabled.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS