block diagonal matrix in the opposite diagonal
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Is there any function/way to construct a matrix with block matrcies in the opposite diagonal. I know of blkdiag( ) but it gives a matrix with blocks in the main diagonal
0 Kommentare
Akzeptierte Antwort
Paul
am 18 Sep. 2022
Here's one option
a = rand(2);
b = rand(2,3);
A = blkdiag(a,b)
D = oppblkdiag(a,b)
function D = oppblkdiag(varargin)
c = cellfun(@(x) fliplr(x),varargin,'UniformOutput',false);
D = fliplr(blkdiag(c{:}));
end
2 Kommentare
Weitere Antworten (0)
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!