eye#

Purpose#

Creates an identity matrix.

Format#

y = eye(n)#
Parameters:

n (scalar) – size of identity matrix to be created.

Returns:

y (NxN identity matrix) – identity matrix, containing 1’s down the diagonal and 0’s everywhere else.

Examples#

x = eye(3);

The code above assigns x to be equal to:

1.0000 0.0000 0.0000
0.0000 1.0000 0.0000
0.0000 0.0000 1.0000

Remarks#

If n is not an integer it will be truncated to an integer.

See also

Functions zeros(), ones()