How To Calculate Double Summation In Matlb

1 次查看(过去 30 天)
Hey there,
I am trying to calculate C, as A=[1 2 3]; B=[1 2 3;4 5 6;7 8 9]; n=3
C=Sigma(i=1 to 3)Sigma(j=1 to3 )A(i)B (i,j)A(j)
Tell me Matlab code to calculate C. Thanks in advance

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2014-12-4
A=[1 2 3];
B=[1 2 3;4 5 6;7 8 9];
s=bsxfun(@times,bsxfun(@times, B,A),A');
s=sum(s(:))

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by