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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by