Fast question!
9 ビュー (過去 30 日間)
古いコメントを表示
1 件のコメント
採用された回答
Walter Roberson
2011 年 11 月 28 日
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 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!