Logical Operator - Perform specified logical operation on input

Library

Logic and Bit Operations

Description

The Logical Operator block performs the specified logical operation on its inputs. An input value is TRUE (1) if it is nonzero and FALSE (0) if it is zero.

You select the Boolean operation connecting the inputs with the Operator parameter list. If you select rectangular as the Icon shape property, the block updates to display the name of the selected operator. The supported operations are given below.

OperationDescription

AND

TRUE if all inputs are TRUE

OR

TRUE if at least one input is TRUE

NAND

TRUE if at least one input is FALSE

NOR

TRUE when no inputs are TRUE

XOR

TRUE if an odd number of inputs are TRUE

NOT

TRUE if the input is FALSE

If you select distinctive as the Icon shape, the block's appearance indicates its function. Simulink® software displays a distinctive shape for the selected operator, conforming to the IEEE® Standard Graphic Symbols for Logic Functions:

The number of input ports is specified with the Number of input ports parameter. The output type is specified with the Output data type parameter. An output value is 1 if TRUE and 0 if FALSE.

The size of the output depends on input vector size and the selected operator:

When configured as a multi-input XOR gate, this block performs an addition- modulo-two operation as mandated by the IEEE Standard for Logic Elements.

Data Type Support

The Logical Operator block accepts real or complex signals of any data type supported by Simulink software, including fixed-point data types.

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 Logical Operator block dialog appears as follows:

Operator

The logical operator to be applied to the block inputs. Valid choices are the operators listed previously.

Number of input ports

The number of block inputs. The value must be appropriate for the selected operator.

Icon shape

The shape of the block icon. Specifying rectangular (the default) results in a rectangular block that displays the name of the selected operator. The distinctive option uses the graphic symbol for the selected operator as specified by the IEEE standard.

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 Logical Operator block dialog appears as follows:

Require all inputs and output to have the same data type

Select to require all inputs and the output 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

No

  


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