identity()

Returns the identity matrix

Syntax
y = identity(rows, columns)

Arguments
Name Description Range Type Required
rows number of rows † [i, ∞) integer yes
columns number of columns † [i, ∞) integer no
† If one argument is supplied, then a square matrix is returned with ones on the diagonal and zeros elsewhere. If two arguments are supplied, then a matrix with size rows cols is returned, again with ones on the diagonal

Examples

y = identity(2)

y(1,1) y(1,2) y(2,1) y(2,2)
1 0 0 1

Defined in

Built in

See Also

ones(), zeros()

 

Privacy Statement  | Terms of Use  | Legal | Contact Us  | © Agilent 2000-2008 

Contents
Additional Resources