Fast question!
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
1 Commento
Risposta accettata
Walter Roberson
il 28 Nov 2011
If the output matrix is to be n by n, then
M = diag(ones(m-1,1),1) + diag(-ones(m-1,1),-1) + diag(1,1-n) + diag(1,n-1);
1 Commento
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Sparse Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!