Apply a formula and create a new matrix
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
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 Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!