MATLAB Functions | Help Desk |
eye
Identity matrix
Y = eye(n) Y = eye(m,n) Y = eye(size(A))
Y = eye(n)
returns the n
-by-n
identity matrix.
Y = eye(m,n) or eye([m n])
returns an m
-by-n
matrix with 1
's on the diagonal and 0
's elsewhere.
Y = eye(size(A))
returns an identity matrix the same size as A
.
The identity matrix is not defined for higher-dimensional arrays. The assignment y = eye([2,3,4])
results in an error.
ones
Create an array of all ones
rand
Uniformly distributed random numbers and arrays
randn
Normally distributed random numbers and arrays
zeros
Create an array of all zeros