cumsum

Cumulative sum

cumsum is not recommended. Use timetable instead. For more information, see Convert Financial Time Series Objects fints to Timetables.

Syntax

newfts = cumsum(oldfts)

Description

newfts = cumsum(oldfts) calculates the cumulative sum of each individual time series data series in the financial time series object oldfts and returns the result in another financial time series object newfts. newfts contains the same data series names as oldfts.

Examples

collapse all

This example shows how to compute the cumulative sum for Disney stock and plot the results.

load disney.mat 
Warning: FINTS is not recommended. Use TIMETABLE instead. For more information, see <a href="matlab:web(fullfile(docroot, 'finance/convert-from-fints-to-timetables.html'))">Convert Financial Time Series Objects (fints) to Timetables</a>.
cs_dis = cumsum(fillts(dis));
Warning: FINTS is not recommended. Use TIMETABLE instead. For more information, see <a href="matlab:web(fullfile(docroot, 'finance/convert-from-fints-to-timetables.html'))">Convert Financial Time Series Objects (fints) to Timetables</a>.
Warning: FINTS is not recommended. Use TIMETABLE instead. For more information, see <a href="matlab:web(fullfile(docroot, 'finance/convert-from-fints-to-timetables.html'))">Convert Financial Time Series Objects (fints) to Timetables</a>.
plot(cs_dis)
Warning: FINTS is not recommended. Use TIMETABLE instead. For more information, see <a href="matlab:web(fullfile(docroot, 'finance/convert-from-fints-to-timetables.html'))">Convert Financial Time Series Objects (fints) to Timetables</a>.
title('Cumulative Sum for Disney')

Figure contains 2 axes. Axes 1 with title Cumulative Sum for Disney contains 4 objects of type line. These objects represent OPEN, HIGH, LOW, CLOSE. Axes 2 contains an object of type line. This object represents VOLUME.

Introduced before R2006a