How I can create this matrix?

1 回表示 (過去 30 日間)
Akash Pal
Akash Pal 2021 年 8 月 5 日
回答済み: Rik 2021 年 8 月 5 日

採用された回答

Rik
Rik 2021 年 8 月 5 日
A simple loop with indexing will do the trick. But in this case you can also use the normal matrix multiplication
A=[1 3 0;2 3 3;2 2 5;3 1 6;4 0 4];
B=[1 5 6 2 6 4;3 6 7 4 7 5;5 3 8 5 8 3;5 2 9 6 3 7;6 6 3 2 1 3];
for k=1:size(A,2)
C(:,k)=sum(A(:,k).*B);
end
C
C = 6×3
56 27 88 53 41 69 75 64 127 46 34 81 49 58 83 53 40 84
((A.')*B).'
ans = 6×3
56 27 88 53 41 69 75 64 127 46 34 81 49 58 83 53 40 84

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by