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 Kommentar

Star Strider
Star Strider am 27 Aug. 2020
That looks like striaghtforward matrix-vector multiplication to me.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Bruno Luong
Bruno Luong am 27 Aug. 2020
Bearbeitet: Bruno Luong am 27 Aug. 2020

0 Stimmen

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

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by