how to get hours of recorded data to 10 minutes time averaged data by moving averaging

4 views (last 30 days)
Hi
I have hours of data recorded. I want them to avrage for 10 minutes by moving avraging. How I can do that ?
Here I am doing correlation with hours of recoreded data. I want to use time avraged data for correlation. Here in this case A and S have hours of data and I want to avrage them in 10 minutes before calculating correlation:
L = length(A) - 300;
B = zeros(L, 1);
for i = 1 : L
cc = corrcoef(A(i:i+300), S(i:i+300))
B(i) = cc(2,1);
end
plot(B);
Any help would be appriciable.

Accepted Answer

Peter Perkins
Peter Perkins on 16 Apr 2019
It's not clear to me exactly what you want to do, but the following computes 10-minute binned means of timestamped data.
>> tt = timetable(rand(100,1),'RowTimes',seconds(1:100:10000));
>> head(tt)
ans =
8×1 timetable
Time Var1
_______ _________
1 sec 0.28029
101 sec 0.81593
201 sec 0.37191
301 sec 0.6861
401 sec 0.31017
501 sec 0.0093475
601 sec 0.1038
701 sec 0.52096
>> ttAvg10 = retime(tt,'regular','mean','TimeStep',minutes(10));
>> head(ttAvg10)
ans =
8×1 timetable
Time Var1
________ _______
0 sec 0.41229
600 sec 0.29121
1200 sec 0.3611
1800 sec 0.48868
2400 sec 0.52948
3000 sec 0.38843
3600 sec 0.51433
4200 sec 0.40669

More Answers (0)

Community Treasure Hunt

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

Start Hunting!