
% Calculate a cumulative sum from a to b
function total = csum2(a,b)
    total = zeros(size(a:b,2),1);
    for i=a:b
        total(i) = total(i-1) + i;
    end
end