Generate matrix with ones on main diagonal and zeros elsewhere
Math Functions / Matrices and Linear Algebra / Matrix Operations
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.
y = eye([M N]) % Equivalent MATLAB code
When you do not select the Inherit output port attributes from input port check box, the input port is disabled, and the dimensions of the output matrix are determined by 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.
Set Matrix size to
[3 6] to
generate the 3-by-6 unit-diagonal matrix below.
The Main pane of the Identity Matrix block dialog appears as follows.
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: a scalar M for a square M-by-M output, or a vector [M N] for an M-by-N output. This parameter is disabled when you select Inherit input port attributes from input port.
The discrete sample period of the output. This parameter is disabled when you select Inherit input port attributes from input port.
The Data Types pane of the Identity Matrix block dialog appears as follows.
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 via back propagation. When you select this option,
the output data type and scaling matches that of the next downstream
A built in data type, such as
An expression that evaluates to a valid data type,
Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Output data type parameter.
See Control Signal Data Types (Simulink) for more information.
|Port||Supported Data Types|