var (timeseries) - Variance of timeseries data

Syntax

ts_var = var(ts)
ts_var = var(ts,'PropertyName1',PropertyValue1,...)

Description

ts_var = var(ts) returns the variance of ts.data. When ts.Data is a vector, ts_var is the variance of ts.Data values. When ts.Data is a matrix, ts_var is a row vector containing the variance 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, var always operates along the first nonsingleton dimension of ts.Data.

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

Examples

The following example shows how to calculate the variance values of a multi-variate timeseries object.

  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 variance of each data column for this timeseries object.

    var(count_ts)
    ans =
    
      1.0e+003 *
    
        0.6437    1.7144    4.6278
    

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

See Also

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

  


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