Simulink Reference    
Relational Operator

Perform the specified relational operation on the inputs

Library

Simulink Math Operations and Fixed-Point Blockset Logic & Comparison

Description

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

The relational operator connecting the two inputs is selected with the Relational Operator parameter. The block icon updates to display the selected operator. The supported operations are given below.

Operation
Description
==
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 output data type is specified with the Output data type mode and Output data type parameters. The output equals 1 for TRUE and 0 for FALSE.

Data Type Support

A Relational Operator block accepts real or complex signals of any data type except int64 and uint64. However, if the Output data type mode parameter is set to Logical, the input may only be boolean or double.

One input can be real and the other complex if the operator is == or !=.

Parameters and Dialog Box

Relational Operator
Designate the relational operator used to compare the two inputs.
Show additional parameters
If selected, additional parameters specific to implementation of the block become visible as shown.

Require all inputs to have same data type
Select to require inputs to have the same data type.
Output data type mode
Set the output data type to boolean, or choose to specify the data type through the Output data type parameter.
Alternatively, you can select Logical to have the output data type determined by the Boolean Logic Signals parameter in the Advanced tab of the Simulink Simulation Parameters Interface. If you select Logical and Boolean Logic Signals is on, then the output data type is always boolean. If you select Logical and Boolean Logic Signals is off, then the output data type will match the input data type is always double.
Output data type
Specify the output data type. You should only use data types that represent zero exactly. Data types that satisfy this condition include signed and unsigned integers and any floating-point data type. This parameter is only visible if Specify via dialog is selected for the Output data type mode parameter.
Enable zero crossing detection
Select to enable zero crossing detection. For more information, see Zero Crossing Detection in the Using Simulink documentation.

Conversions and Operations

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. Refer to Parameter Conversions in the Fixed-Point Blockset documentation for more information about parameter conversions.

Characteristics

Dimensionalized
Yes
Direct Feedthrough
Yes
Sample Time
Inherited from driving block
Scalar Expansion
Of inputs
Zero Crossing
No, unless Enable zero crossing detection is selected.


  Real-Imag to Complex Relay