Overlaying several matrices diagonally to create a larger matrix
Show older comments
Hello,
I am currently struggling to figure a way out to connect around 10-12 8x8 matrices diagonally in a way as shown in this image

Where essentially the corner 4x4 from the 8x8 matrix would be overlayed diagonally. Everything else in the final matrix is to be zero.
Hence was wondering if anyone has any experience of forming matrices like this and perhaps would be able to help.
So far the only solution I have figured out is basically this:
% 8x8 matrix
m = (miu*l/420).*[156 0 0 22*l 54 0 0 -13*l;...
0 156 -22*l 0 0 54 13*l 0;...
0 -22*l 4*l^2 0 0 -13*l -3*l^2 0;...
22*l 0 0 4*l^2 13*l 0 0 -3*l^2;...
54 0 0 13*l 156 0 0 -22*l;...
0 54 -13*l 0 0 156 22*l 0;...
0 13*l -3*l^2 0 0 22*l 4*l^2 0;...
-13*l 0 0 -3*l^2 -22*l 0 0 4*l^2];
%miu and l varies, so m = m1; m2 m3... etc.
%create large matrix of zeros
M=zeros(52);
M(1:8,1:8)=m1;
M(5:12, 5:12) = m2;
M(9:16, 9:16) = m3;
M(13:20, 13:20) = m4;
M(17:24, 17:24) = m5;
M(21:28, 21:28) = m6;
M(25:32, 25:32) = m7;
M(29:36, 29:36) = m8;
M(33:40, 33:40) = m9;
M(37:44, 37:44) = m10;
M(41:48, 41:48) = m11;
M(45:52, 45:52) = m12;
Which I think is a very crude solution and for large matrices is not feasible, was thinking of somehow introducing a loop to do it automatically (in which case would also need to figure how to calculate the necessary size for the zeros matrix). So yeah, perhaps someone will know a trick or two.
Kind regards, Edvardas
1 Comment
Dishant Arora
on 10 Nov 2014
Add a for loop.
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!