Apply a formula and create a new matrix

2 ビュー (過去 30 日間)
matlabuser
matlabuser 2020 年 8 月 27 日
コメント済み: matlabuser 2020 年 8 月 28 日
Suppose I have 2 matrices :
x =
and y =
I am not able to figure out the code that will output a matrix which calculates the following:
  1 件のコメント
Star Strider
Star Strider 2020 年 8 月 27 日
That looks like striaghtforward matrix-vector multiplication to me.

サインインしてコメントする。

採用された回答

Bruno Luong
Bruno Luong 2020 年 8 月 27 日
編集済み: Bruno Luong 2020 年 8 月 27 日
b.'*sum(A,2)
sum(A,2).'*b % preferable than
sum(A.'*b) % or
sum(b.'*A) % or
sum(A.*b,'all')
or
s = 0;
for i=1:size(A,1)
for j=1:size(A,2)
s=s+A(i,j)*b(i);
end
end
s
  1 件のコメント
matlabuser
matlabuser 2020 年 8 月 28 日
Thanks a lot.

サインインしてコメントする。

その他の回答 (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