Block sub diagonals matrix
Mostrar comentarios más antiguos
I have known how to build a block main diagonals matrix. But I also need to fill the sub diagonals.
For example,
A=rand(3,3,5);
B=rand(3,3,5);
C=rand(3,3,5);
and I want to build a matrix D like,
D=[A(:,:,1),B(:,:,1),0,...,0
C(:,:,1),A(:,:,2),B(:,:,2),...,0
C(:,:,2),A(:,:,3),B(:,:,3),...,0
...
A(:,:,5)]
D is 15×15
And A(:,:,i) is main diagonal, B and C is sub diagonals.
Kindly help me with this.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Operating on Diagonal Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!