creating multidiagonal matrix from a basic square matrix
1 回表示 (過去 30 日間)
古いコメントを表示
For a finite difference code I need to create a multidiagonal matrix from a basic square matrix A:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/167989/image.png)
How can I do this without using a for loop?
0 件のコメント
採用された回答
Andrei Bobrov
2017 年 10 月 8 日
編集済み: Andrei Bobrov
2017 年 10 月 8 日
A = magic(3);
n = 8;
B = repmat({A},1,n);
out = blkdiag(B{:});
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Operating on Diagonal Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!