Fast question!
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
1 Kommentar
Akzeptierte Antwort
Walter Roberson
am 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 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Sparse Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!