eye()

Read(1969) Label: matrix, dimension, unit matrix,

Description:

Create a matrix whose major diagonal element is 1 and other elements are 0.

Syntax:

eye(n1,n2)

Note:

The external library function (See External Library Guide) creates a new matrix according to parameter n1 and parameter n2 that define the dimensions. When only one parameter is present, the function creates a unit matrix of size n.

Parameter:

n1/ n2

Positive integers

Return value

A sequence

Example:

 

A

 

1

=eye(4,3)

Create a 4*3 matrix with the length of diagonal line being 1.

2

=eye(3)

Create a unit matrix of size 3.