eye

Returns an identity matrix.

Syntax

R = eye()

R = eye(n)

R = eye(m,n)

R = eye([m,n])

Inputs

n
Number of columns (and rows, if one input) of the output matrix.
Type: double | integer | logical | struct | cell
Dimension: scalar | vector | matrix
m
Number of rows of the output matrix.
Type: double | integer | logical | struct | cell
Dimension: scalar | vector | matrix

Outputs

R
Resulting identity matrix.

Examples

Simple N input:

R = eye(3)
R = [ 1 0 0 ; 0 1 0 ; 0 0 1 ]

Simple M x N input:

R = eye(3,2)
R = [ 1 0 ; 0 1 ; 0 0 ]