eye

Purpose

Identity matrix.

Synopsis

Y = eye(n)
Y = eye(m,n)
Y = eye(size(A))

Description

Y = eye(n) is the n-by-n identity matrix.

Y = eye(m,n) or eye([m,n]) is an m-by-n matrix with 1s on the diagonal and 0s elsewhere.

Y = eye(size(A)) is the same size as A.

See Also

ones, rand, zeros

(c) Copyright 1994 by The MathWorks, Inc.