sum (timeseries) - Sum of timeseries data

Syntax

ts_sm = sum(ts)
ts_sm = sum(ts,'PropertyName1',PropertyValue1,...)

Description

ts_sm = sum(ts) returns the sum of the time-series data. When ts.Data is a vector, ts_sm is the sum of ts.Data values. When ts.Data is a matrix, ts_sm is a row vector containing the sum of each column of ts.Data (when IsTimeFirst is true and the first dimension of ts is aligned with time). For the N-dimensional ts.Data array, sum always operates along the first nonsingleton dimension of ts.Data.

ts_sm = sum(ts,'PropertyName1',PropertyValue1,...) specifies the following optional input arguments:

Examples

  1. Load a 24-by-3 data array.

    load count.dat
    
  2. Create a timeseries object with 24 time values.

    count_ts = timeseries(count,1:24,'Name','CountPerSecond')
    
  3. Calculate the sum of each data column for this timeseries object.

    sum(count_ts)
    
    ans =
    
             768        1117        1574
    

The sum is calculated independently for each data column in the timeseries object.

See Also

iqr (timeseries), mean (timeseries), median (timeseries), std (timeseries), var (timeseries), timeseries

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS