Periodic average of FINTS object
avgfts = peravg(tsobj) avgfts = peravg(tsobj, numperiod) avgfts = peravg(tsobj, daterange)
 Financial time series object 
 (Optional) Integer specifying the number of data points over which each periodic average should be averaged 
 (Optional) Time period over which the data is averaged 
peravg
calculates periodic averages of a
financial time series object. Periodic averages are calculated from
the values per period defined. If the period supplied is a character
vector, it is assumed as a range of date character vector. If the
period is entered as numeric, the number represents the number of
data points (financial time series periods) to be included in a period
for the calculation. For example, if you enter '01/01/98::01/01/99'
as
the period input argument, peravg
returns the average
of the time series between those dates, inclusive. However, if you
enter the number 5
as the period input, peravg
returns
a series of averages from the time series data taken 5 date points
(financial time series periods) at a time.
avgfts = peravg(tsobj, numperiod)
returns
a structure avgfts
that contains the periodic (per numperiod
periods)
average of the financial time series object. avgfts
has
field names identical to the data series names of tsobj
.
avgfts = peravg(tsobj, daterange)
returns
a structure avgfts
that contains the periodic (as
specified by daterange
) average of the financial
time series object. avgfts
has field names identical
to the data series names of tsobj
.
Note:

If you enter 01Jan2001::03Jan2001
as
the period input argument, peravg
returns the average
of the time series between those dates, inclusive. However, if you
enter the number 5
as the period input, peravg
returns
a series of averages from the time series data, taken 5 date points
at a time.
%% Create the FINTS object %% dates = ['01Jan2001';'01Jan2001'; '02Jan2001'; ... '02Jan2001'; '03Jan2001';'03Jan2001']; times = ['11:00';'12:00';'11:00';'12:00';'11:00';'12:00']; dates_times = cellstr([dates, repmat(' ', size(dates, 1), 1), times]); data = [(1:6)', 2*(1:6)']; myFts = fints(dates_times, data, {'Data1', 'Data2'}, 1, 'My first FINTS') %% Create the FINTS object %% [p, pFts] = peravg(myFts, 3)
p = Data1: [2 5] Data2: [4 10] pFts = desc: My first FINTS freq: Daily (1) 'dates: (2)' 'times: (2)' 'Data1: (2)' 'Data2: (2)' '02Jan2001' '11:00' [ 2] [ 4] '03Jan2001' '12:00' [ 5] [ 10]
[p, pFts] = peravg(myFts,'01Jan2001 12:00::03Jan2001 11:00')
p = Data1: 3.5000 Data2: 7 pFts = desc: My first FINTS freq: Daily (1) 'dates: (1)' 'times: (1)' 'Data1: (1)' 'Data2: (1)' '03Jan2001' '11:00' [ 3.5000] [ 7]