how do i create a block matrix and do operations with the specific blocks in it
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
so lets say i have a bunch of 2x2 matrix :a,b,c,d
and i want to put them in another matrix Q
how do i do that? and can i do operations with the blocks in q as standalone matrix in this way or not?
0 commentaires
Réponses (1)
Ameer Hamza
le 15 Avr 2020
Modifié(e) : Ameer Hamza
le 15 Avr 2020
You can concatenate the matrices like this
a = [1 2; 3 4];
b = [4 5; 7 8];
c = [9 10; 11 12];
d = [13 14; 15 16];
Q = [a b; c d]; % this matrix is 4x4
To do operation on a block of Q, you can use indexing
Q(1:3, 1:3) = Q(1:3, 1:3)*2; % multiply top-left 3x3 block with 2
Read these for more details
0 commentaires
Voir également
Catégories
En savoir plus sur Creating and Concatenating 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!