how do i create a block matrix and do operations with the specific blocks in it
13 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Ameer Hamza
on 15 Apr 2020
Edited: Ameer Hamza
on 15 Apr 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 Comments
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!