how can i get the average of group of rows in time series?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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.
0 comentarios
Respuestas (1)
W. Owen Brimijoin
el 5 de Feb. de 2015
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);
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!