speye

Sparse identity matrix creation.

Syntax

s = speye(m)

s = speye(m, n)

s = speye(dim)

Inputs

m
The number of rows.
Type: integer
Dimension: scalar
n
The number of columns. Default: m.
Type: integer
Dimension: scalar
dim
A two-element vector containing the dimensions.
Type: integer
Dimension: vector

Outputs

s
The sparse identity matrix.
Type: integer
Dimension: matrix

Example

speye(4,6)
ans = sparse [4 x 6], nnz = 4
[1,1] 1
[2,2] 1
[3,3] 1
[4,4] 1