cumsum

Purpose

Cumulative sum.

Synopsis

Y = cumsum(X)

Description

Y = cumsum(X), where X is a vector, returns a matrix containing the cumulative sum of the elements of X. If X is a matrix, Y is a matrix containing the cumulative sums over each column.

Examples

cumsum(1:5) = [1  3  6  10  15]

See Also

sum

(c) Copyright 1994 by The MathWorks, Inc.