function csum = cumulativeSum(v)
% csum is the vector of cumulative sums of vector v. Assume v is not empty.

csum= zeros(1, length(v));  % not necessary but speeds up execution
csum(1)= v(1);
for k = 2:length(v)
    csum(k)= csum(k-1) + v(k);
end
