Cartesian product of 2 matrices
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Let A and B are sets of 16 matrices size 2x2, say A = {M1,M2,M3,...,M16}, B = {M1,M2,M3,...,M16}, with entry each Mi, i = 1,..,16 are 0 and 1, eg : M1=[0 0; 0 0], M2 = [0 1; 0 0],...,M16 = [1 1; 1 1]. How the syntax of those cartesian product of A and B ? Later the result AxB = {(M1,M1), (M1,M2),...,(M16,M16)} with total elements of AxB are 256 paired orders.
1 Kommentar
Jesús G.
am 9 Okt. 2023
May i ask what was the motivation for this problem. I what type of problem did you find such cartesian product of matrices
Antworten (1)
Torsten
am 8 Jun. 2022
Bearbeitet: Torsten
am 8 Jun. 2022
m = 4;
justRows = dec2bin(0:2^m-1)-'0';
n = size(justRows,1);
M = cell(2^m,1);
for i = 1:n
A = reshape(justRows(i,:),[sqrt(m),sqrt(m)]);
M{i} = A;
end
McrossM = cell(n,n);
for i=1:n
for j=1:n
McrossM{i,j} = {M{i},M{j}};
%disp(McrossM{i,j})
end
end
2 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!