block diagonal matrix in the opposite diagonal
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Paul
le 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 commentaires
Plus de réponses (0)
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!