MATLAB: Double sum with upper limits MATLABsum Hi I am trying to do the following calululation in matlab: But I do not how how to do the two sums in the front. Our data (d) is a 67×120 array. Any suggestions would be appreciated 🙂 Best Answer s = (1:size(d, 1)).';result = sum(sum(d .* cos(s))) / sum(cos(s));Loops not needed, they're just a waste of time. Related SolutionsMATLAB: Input euler angles which outputs rotation matrix R function R = RotationMatrix(phi,theta,psi)p = phi ;t = theta ;s = psi ;D = [cos(p) sin(p) 0 ; -sin(p) cos(p) 0 ; 0 0 1] ;C = [1 0 0 ; 0 cos(t) sin(t) ; 0 -sin(t) cos(t)] ;B = [cos(s) sin(s) 0 ; -sin(s) cos(s) 0 ; 0 0 1] ;R = B*C*D ; endREad more here: http://mathworld.wolfram.com/EulerAngles.html Related Question
Best Answer