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

1 visualización (últimos 30 días)
S Priya
S Priya el 22 de Sept. de 2021
Editada: Jan el 23 de Sept. de 2021
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 comentarios
S Priya
S Priya el 22 de Sept. de 2021
Sorry, its not a diagonal matrix.

Iniciar sesión para comentar.

Respuesta aceptada

Jan
Jan el 22 de Sept. de 2021
Editada: Jan el 23 de Sept. de 2021
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

Más respuestas (1)

Paul
Paul el 22 de Sept. de 2021
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 comentario
Stephen23
Stephen23 el 22 de Sept. de 2021
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

Iniciar sesión para comentar.

Categorías

Más información sobre Operating on Diagonal Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by