Build a Relation Between Matrix Elements
Show older comments
I have a complex valued matrix for example:
a = complex(1.1,-1.3); b = complex(1.3,1.2);c = complex(1.5,-1.4); d = complex(1.8,1.2); % random numbers
A = [a b; c d];
How can I build a relation between the elements of the matrix as
, and then get the sume for each element. All the relations would be calculated as:
A1_1 = A(1) + A(2) + A(3) + A(4);
A1_2 = A(1) + A(2) + A(3) - A(4);
A1_3 = A(1) + A(2) - A(3) + A(4);
A1_4 = A(1) - A(2) + A(3) - A(4);
A1_5 = A(1) + A(2) - A(3) - A(4);
A1_6 = A(1) - A(2) - A(3) + A(4);
A1_7 = A(1) - A(2) + A(3) + A(4);
A1_8 = A(1) - A(2) - A(3) - A(4);
A2_1 = A(2) + A(3) + A(4) + A(1);
A2_2 = A(2) + A(3) + A(4) - A(1);
A2_3 = A(2) + A(3) - A(4) + A(1);
A2_4 = A(2) - A(3) + A(4) - A(1);
A2_5 = A(2) + A(3) - A(4) - A(1);
A2_6 = A(2) - A(3) - A(4) + A(1);
A2_7 = A(2) - A(3) + A(4) + A(1);
A2_8 = A(2) - A(3) - A(4) - A(1);
A3_1 = A(3) + A(4) + A(1) + A(2);
A3_2 = A(3) + A(4) + A(1) - A(2);
A3_3 = A(3) + A(4) - A(1) + A(2);
A3_4 = A(3) - A(4) + A(1) - A(2);
A3_5 = A(3) + A(4) - A(1) - A(2);
A3_6 = A(3) - A(4) - A(1) + A(2);
A3_7 = A(3) - A(4) + A(1) + A(2);
A3_8 = A(3) - A(4) - A(1) - A(2);
A4_1 = A(4) + A(3) + A(2) + A(1);
A4_2 = A(4) + A(3) + A(2) - A(1);
A4_3 = A(4) + A(3) - A(2) + A(1);
A4_4 = A(4) - A(3) + A(2) - A(1);
A4_5 = A(4) + A(3) - A(2) - A(1);
A4_6 = A(4) - A(3) - A(2) + A(1);
A4_7 = A(4) - A(3) + A(2) + A(1);
A4_8 = A(4) - A(3) - A(2) - A(1);
A1 = A1_1 + A1_2 + A1_3 + A1_4 + A1_5 + A1_6 + A1_7 + A1_8
A2 = A2_1 + A2_2 + A2_3 + A2_4 + A2_5 + A2_6 + A2_7 + A2_8
A3 = A3_1 + A3_2 + A3_3 + A3_4 + A3_5 + A3_6 + A3_7 + A3_8
A4 = A4_1 + A4_2 + A4_3 + A4_4 + A4_5 + A4_6 + A4_7 + A4_8
ANew = [A1 A2; A3 A4]
4 Comments
John D'Errico
on 1 Jun 2022
Edited: John D'Errico
on 1 Jun 2022
I'm sorry, but this makes no sense as you said it. Are you asking to generate some sort of "random" matrix with some property as a relationship between the elements? Or, are you asking to compute the set of combinations of all elements of some given matrix? If it is the latter, then it would be easy, even trivial, as long as the matrix is not too large. If the former in some form, then you need to explain yourself far more clearly. In any case, you should be explicit.
MarshallSc
on 1 Jun 2022
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing 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!