Identity Matrix

Generate matrix with ones on main diagonal and zeros elsewhere

  • Library:
  • DSP System Toolbox / Math Functions / Matrices and Linear Algebra / Matrix Operations

    DSP System Toolbox / Sources

  • Identity Matrix block

Description

The Identity Matrix block generates a rectangular matrix with ones on the main diagonal and zeros elsewhere.

When you select the Inherit output port attributes from input port check box, the input port is enabled, and an M-by-N matrix input generates an M-by-N matrix output with the same sample period as the input. The values in the input matrix are ignored. The equivalent MATLAB® code is:

y = eye([M N])

When you clear the Inherit output port attributes from input port check box, the input port is disabled, and the block determines the dimensions of the output matrix based on the Matrix size parameter. A scalar value, M, specifies an M-by-M identity matrix, while a two-element vector, [M N], specifies an M-by-N unit-diagonal matrix. You can specify the output sample period using the Sample time parameter.

Ports

Input

expand all

Input signal used to determine dimensions of the output matrix, specified as a scalar, vector, or matrix. When the input signal is an M-by-N matrix, the block generates an M-by-N matrix output with the same sample period as the input. The values in the input matrix are ignored.

Dependencies

To enable this port, select the Inherit output port attributes from input port check box.

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

Output

expand all

Identity matrix, specified as a scalar, vector, or matrix. For more information on how the block generates output, see Description.

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

Parameters

expand all

Main

Enables the input port when selected. In this mode, the output inherits its dimensions, sample period, and data type from the input. The output is always real.

The number of rows and columns in the output matrix. You can specify:

  • A positive integer scalar M to create a square M-by-M output.

  • A vector of positive integers, [M N], to create an M-by-N output.

Dependencies

To enable this parameter, clear the Inherit output port attributes from input port check box.

The discrete sample period of the output specified as a real-valued scalar.

Dependencies

To enable this parameter, clear the Inherit output port attributes from input port check box.

Data Types

Specify the output data type for this block. You can select one of the following:

  • A rule that inherits a data type, for example, Inherit: Inherit via back propagation. When you select this option, the output data type and scaling matches that of the next downstream block.

  • A built-in data type, such as double

  • An expression that evaluates to a valid data type, for example, fixdt(1,16)

For help setting data type parameters, display the Data Type Assistant by clicking the Show data type assistant button .

See Control Signal Data Types (Simulink) for more information.

Block Characteristics

Data Types

Boolean | double | fixed point | integer | single

Direct Feedthrough

no

Multidimensional Signals

no

Variable-Size Signals

no

Zero-Crossing Detection

no

Extended Capabilities

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

See Also

Blocks

Functions

Introduced before R2006a