How to use a matrix of 12*12 to form a matrix of 96*96?

1 回表示 (過去 30 日間)
S Priya
S Priya 2021 年 9 月 22 日
編集済み: Jan 2021 年 9 月 23 日
If B is a 12*12 matrix, and I want to place this B matrix as diagonal matrix of 96*96, How to form this 96*96 diagonal matrix?
  4 件のコメント
S Priya
S Priya 2021 年 9 月 22 日
Sorry, its not a diagonal matrix.

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

採用された回答

Jan
Jan 2021 年 9 月 22 日
編集済み: Jan 2021 年 9 月 23 日
gLg = kron(eye(8), Lg)
% A small example:
X = [1,2; 3,4];
kron(eye(3), X)
ans = 6×6
1 2 0 0 0 0 3 4 0 0 0 0 0 0 1 2 0 0 0 0 3 4 0 0 0 0 0 0 1 2 0 0 0 0 3 4

その他の回答 (1 件)

Paul
Paul 2021 年 9 月 22 日
It's too bad we can't do something like this:
B = [1 2;3 4]; repeats = 2; % use a smaller example
% R = blkdiag(repmat({B},1,repeats){:}) % throws error
and instead have to do this
R = blkdiag(struct('temp',repmat({B},1,repeats)).temp)
R = 4×4
1 2 0 0 3 4 0 0 0 0 1 2 0 0 3 4
  1 件のコメント
Stephen23
Stephen23 2021 年 9 月 22 日
Simpler:
B = {[1,2;3,4]};
R = 2; % use a smaller example
M = blkdiag(B{ones(1,R)})
M = 4×4
1 2 0 0 3 4 0 0 0 0 1 2 0 0 3 4

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

カテゴリ

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