Our professor calls this the connectivity array (but not referring to Matlab)
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
The goal is to combine a 3x3 matrix in a way that it becomes an 11x11 matrix. It'll be done such that the 3x3 matrix will repeat diagonally, for example if 3x3 matrix is [F G H ;
G I J;
H J F]
Then the 11x11 matrix should look like this:
[F G H 0 0 0 0 0 0 0 0;
G I J 0 0 0 0 0 0 0 0;
H J 2*F G H 0 0 0 0 0 0;
0 0 G I J 0 0 0 0 0 0;
0 0 H J 2*F G H 0 0 0 0;
0 0 0 0 G I J 0 0 0 0;
0 0 0 0 H J 2*F G H 0 0 0 0;
0 0 0 0 0 0 G I J 0 0;
0 0 0 0 0 0 H J 2*F G H;
0 0 0 0 0 0 0 0 G I J;
0 0 0 0 0 0 0 0 H J F]
notice the addition of F as a "connectivity array"
I have tried some stuff but nothing seems to work except for typing it manually and this becomes a problem if my base matrix (in this case 3x3) becomes a 10x10 or anything greater than 3x3
0 Commenti
Risposte (1)
Chunru
il 23 Set 2022
% [F G H ;
% G I J;
% H J F]
% Then the 11x11 matrix should look like this:
% [F G H 0 0 0 0 0 0 0 0;
% G I J 0 0 0 0 0 0 0 0;
% H J 2F G H 0 0 0 0 0 0;
% 0 0 G I J 0 0 0 0 0 0;
% 0 0 H J 2F G H 0 0 0 0;
% 0 0 0 0 G I J 0 0 0 0;
% 0 0 0 0 H J 2F G H 0 0;
% 0 0 0 0 0 0 G I J 0 0;
% 0 0 0 0 0 0 H J 2F G H;
% 0 0 0 0 0 0 0 0 G I J;
% 0 0 0 0 0 0 0 0 H J F]
F = 1; G = 2; H = 3; I = 4; J = 5;
A = [F G H ; G I J; H J F]
B = zeros(11, 11);
for i=0:4
B(i*2+(1:3), i*2+(1:3)) = B(i*2+(1:3), i*2+(1:3)) + A;
end
B
0 Commenti
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!