how can i get the average of group of rows in time series?

1 回表示 (過去 30 日間)
zeinab
zeinab 2015 年 2 月 5 日
回答済み: W. Owen Brimijoin 2015 年 2 月 5 日
i have time series recording one point value every 1 second, i need matlab to calculate the average of each group of 60 points to get 1 minute value along the time series(not moving average). i think i can use peravg or accumarray functions but i don't understand how to use it, so if you please could help.

回答 (1 件)

W. Owen Brimijoin
W. Owen Brimijoin 2015 年 2 月 5 日
I might suggest a function I have posted on the FileExchange . It's called timeseries_indexer.m and it takes a time series as an input along with timestamps, labels, and a window and outputs the exact kind of average you are looking for.
In your case, your time stamps would be
timestamps = [1:60:length(data)];
your labels would be
labels = ones(size(timestamps));
and your window would be
win = [0 59]; %to stretch from sample 1 to sample 60
Call it like so and watch the magic!
mean_data = timeseries_indexer(labels,timestamps,win,data);

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by