S = speye(sz) returns a matrix with ones on
the main diagonal and zeros elsewhere. The size vector sz defines
size(S). For example, speye([2 3]) returns a 2-by-3
matrix.
Create a 1000-by-1000 square sparse identity matrix and view the sparsity pattern.
I = speye(1000);
spy(I)
The result is the same as sparse(eye(1000)), but this latter version requires temporary storage for the full representation before it is converted to sparse storage.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.