speye
Sparse identity matrix creation.
Syntax
s = speye(m)
s = speye(m, n)
s = speye(dim)
Inputs
- m
- The number of rows.
- n
- The number of columns. Default: m.
- dim
- A two-element vector containing the dimensions.
Outputs
- s
- The sparse identity matrix.
Example
speye(4,6)
ans = sparse [4 x 6], nnz = 4
[1,1] 1
[2,2] 1
[3,3] 1
[4,4] 1