FUNCTION REFERENCE

eye

Identity matrix.

Identity matrix.

Syntax

eye(n)

Syntax

eye(r, c)

Returns a matrix with ones on the main diagonal.

Syntax

eye(..., 'single')

Syntax

eye(..., 'like', single(1))

Example

eye(2, 'single')

Example

eye(2)   % [1 0; 0 1]

Class names 'single' and int8 through uint64 are accepted, as are typed integer/single 'like' prototypes.

Differences from MATLAB: No size vector.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.