How can I diagonalize a matrix which consists of matrix?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Steven Lord
am 20 Sep. 2018
2 Kommentare
Sinwoo Jeong
am 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
am 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{:})
Siehe auch
Kategorien
Mehr zu Operating on Diagonal Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!