MATLAB: How To Calculate Double Summation In Matlb double summation 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 Best Answer 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(:)) Related SolutionsMATLAB: How to enter values into a workspace A=[1 2 3;4 5 6;7 8 9] MATLAB: How to vectorize double sum >> N = 4;>> x = randi(9,3,N)x = 5 4 8 9 2 9 9 8 1 1 4 1>> F = @(c)bsxfun(@minus,x(:,c),x(:,c+1:N));>> M = cell2mat(arrayfun(F,1:N-1,'uni',0))M = 1 -3 -4 -4 -5 -1 -7 -7 -6 0 1 1 0 -3 0 -3 0 3 Related QuestionWhat is the mistake,Generate all possible combinationsFinding average between TFunct1,TFunct2,TFunct3How To Calculate Double Summation In MatlbHow to sum two rows in a matrixNANMEANs for each (n,m) position over several matrices with the same size
Best Answer