How to sum each column element of one matrix with all column elements of another matrix?
4 ビュー (過去 30 日間)
古いコメントを表示
Jakov Simjanoski
2018 年 7 月 8 日
コメント済み: vinjamoori vikas
2020 年 12 月 17 日
Sorry I cannot formulate my question in a clearer way. Here is what I want to do: A = [ a, b; c, d ] and B = [ i, j; k, l ] I want to get: C = [ (a+i), (b+j); (a+k), (b+l); (c+i), (d+j); (c+k), (d+l) ]. Thank you in advance.
0 件のコメント
採用された回答
Anton Semechko
2018 年 7 月 8 日
Do
kron([a b;c d],[1;1]) + kron([1;1],[i j;k l])
Here is an example using symbolic expressions
syms a b c d i j k l
kron([a b;c d],[1;1]) + kron([1;1],[i j;k l])
ans =
[ a + i, b + j]
[ a + k, b + l]
[ c + i, d + j]
[ c + k, d + l]
6 件のコメント
vinjamoori vikas
2020 年 12 月 17 日
Sir, I have total six matrices each with the size 4x4. I want to add all the combinations of the columns.
That means each column of one matrix with each other column of other matrices. I should get total of 4^6 summed vectors. Please suggest me something.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!