How can I diagonalize a matrix which consists of matrix?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a matrix like this.
[[A]; [B]; [C]],
where, [A], [B], [C] are matrix having arbitral size. Actually, the real matrix I'm handling has much bigger size ([A], [B], [C], [D], [E], ... more than 100)
What I want to get is [[A] [0] [0]; [0] [B] [0]; [0] [0] [C]].
here, each [0] has proper matrix size.
I can do this using for-loop but I'd like to find a simpler and faster way.
Could you guys help me please?
0 commentaires
Réponses (1)
Steven Lord
le 20 Sep 2018
2 commentaires
Sinwoo Jeong
le 20 Sep 2018
Thank you for your comment. But that function makes me to type blkdiag(A, B, C, D, E, ...). In my case, I have more than 100 matrices. Could you please tell me how I can avoid typing every single matrix name?
Steven Lord
le 20 Sep 2018
Store your matrices in a cell array instead of in individual variables.
C = {magic(5), ones(4), full(gallery('tridiag', 7))}
D = blkdiag(C{:})
Voir également
Catégories
En savoir plus sur Operating on Diagonal Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!