how to optimize a diag matrix with sparse

4 visualizaciones (últimos 30 días)
Dimitrios
Dimitrios el 5 de Jun. de 2014
Respondida: James Tursa el 5 de Jun. de 2014
How to optimize this diagonal matrix using sparse :
a=diag([-ones(9,1)],-1)+diag([ones(10,1)])+diag([0 ones(1,4) 0],4)

Respuestas (1)

James Tursa
James Tursa el 5 de Jun. de 2014
If you mean how to create the equivalent sparse matrix to your full matrix shown, try using the spdiags function instead of diag.

Categorías

Más información sobre Sparse Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by