Function Reference
— Built-in Function: eye (x)
— Built-in Function: eye (n, m)
— Built-in Function: eye (..., class)

Return an identity matrix. If invoked with a single scalar argument, eye returns a square matrix with the dimension specified. If you supply two scalar arguments, eye takes them to be the number of rows and columns. If given a vector with two elements, eye uses the values of the elements as the number of rows and columns, respectively. For example,

          eye (3)
                1  0  0
                  0  1  0
                  0  0  1

The following expressions all produce the same result:

          eye (2)
          ==
          eye (2, 2)
          ==
          eye (size ([1, 2; 3, 4])

The optional argument class, allows eye to return an array of the specified type, like

          val = zeros (n,m, "uint8")

Calling eye with no arguments is equivalent to calling it with an argument of 1. This odd definition is for compatibility with Matlab.