3 views (last 30 days)
I am trying to compute an average and variance of a large data set (~330000 rows x 3 different columns), but I'd like to take the average and var. of every 240 entries. I think you'd call this a moving average/variance, but I'm not sure.
Can you please provide hints as to accomplish this? I'm thinking either a for-loop or using the 'filter' function, but am not sure how to approach this problem...
Thanks in advance,
Jarrod Rivituso on 27 Apr 2011
Here's a filter function example for ya...
Doc reference: http://www.mathworks.com/help/techdoc/ref/filter.html
Example code for simple moving average:
data = rand(4000,3);
window = ones(240,1)/240;
filtered_data = filter(window,1,data);
Hope this helps!