Main Content


Indicate sign of input

  • Library:
  • Simulink / Math Operations

    HDL Coder / HDL Floating Point Operations

    HDL Coder / Math Operations

  • Sign block


Block Behavior for Real Inputs

For real inputs, the Sign block outputs the sign of the input:

Greater than zero1
Equal to zero0
Less than zero–1

For vector and matrix inputs, the block outputs a vector or matrix where each element is the sign of the corresponding input element, as shown in this example:

Block Behavior for Complex Inputs

When the input u is a complex scalar, the block output matches the MATLAB® result for:

sign(u) = u./ abs(u)

When an element of a vector or matrix input is complex, the block uses the same formula that applies to scalar input, as shown in this example:



expand all

Input signal whose sign will determine the output.

The block supports complex input signals only for floating-point data types, double and single.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | fixed point
Complex Number Support: Yes


expand all

Output signal that is the sign of the input signal.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean
Complex Number Support: Yes


expand all

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

Programmatic Use

Block Parameter: ZeroCross
Type: character vector | string
Values: 'off' | 'on'
Default: 'on'

Specify the sample time as a value other than -1. For more information, see Specify Sample Time.


This parameter is not visible unless it is explicitly set to a value other than -1. To learn more, see Blocks for Which Sample Time Is Not Recommended.

Programmatic Use

Block Parameter: SampleTime
Type: string scalar or character vector
Default: "-1"

Block Characteristics

Data Types

Boolean | double | fixed point | integer | single

Direct Feedthrough


Multidimensional Signals


Variable-Size Signals


Zero-Crossing Detection


Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

PLC Code Generation
Generate Structured Text code using Simulink® PLC Coder™.

Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.

Version History

Introduced before R2006a

See Also