From: Matt J on 25 Mar 2010 16:03 James Allison <james.allison(a)mathworks.com> wrote in message <hogcta$dqh$1(a)fred.mathworks.com>... > How about: > > sum(sum((2:7)'*(1:5).^2)) ======== which can be simplified a bit more to sum(2:7)*sum((1:5).^2) Also, the sums of consecutve integers and squares of integers have closed form formulas, so this could also be done without any summation at all: K=7; T=5; Result=(K*(K+1)/2-1)*T*(T+1)*(2*T+1)/6 |