creating multidiagonal matrix from a basic square matrix

1 回表示 (過去 30 日間)
Saeid
Saeid 2017 年 10 月 8 日
コメント済み: Saeid 2017 年 10 月 8 日
For a finite difference code I need to create a multidiagonal matrix from a basic square matrix A:
How can I do this without using a for loop?

採用された回答

Andrei Bobrov
Andrei Bobrov 2017 年 10 月 8 日
編集済み: Andrei Bobrov 2017 年 10 月 8 日
A = magic(3);
n = 8;
B = repmat({A},1,n);
out = blkdiag(B{:});
  1 件のコメント
Saeid
Saeid 2017 年 10 月 8 日
Thanks Andrei. That was great help!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOperating on Diagonal Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by