Filter löschen
Filter löschen

daily averages of hourly data

2 Ansichten (letzte 30 Tage)
aggelos
aggelos am 4 Nov. 2012
Kommentiert: Felipe am 12 Apr. 2017
how can I compute daily averages of hourly data in a column vector; the data have the following form and i have a total of 52584 observations.
1 4,36188440018071 2 4,24430502188277 3 4,21243736283539 4 4,21243736283539 5 4,16143877425792 6 4,16143877425792 7 4,13989429397492 8 4,13989429397492 9 4,30996473520857 10 4,30996473520857 11 4,45026849245099 12 4,32251521567370 13 4,32251521567370 14 4,32251521567370 15 4,28974153869163 16 4,32251521567370 17 4,51756258906766 18 4,74942794173664 19 4,74942794173664 20 4,57621696414906 21 4,51756258906766 22 4,35334832680403 23 4,32616576991108 24 4,30996473520857 1 4,20596290364125 2 4,13241078399449 3 4,13241078399449 4 4,06761746912333 5 4,06761746912333 6 4,06086643406207 7 4,20596290364125 8 4,19850762703210 9 4,25124417118600 10 4,36214866068717 11 4,45026849245099 12 4,37629784430253 13 4,33589281863478 14 4,32251521567370 15 4,32251521567370 16 4,32251521567370 17 4,50865928560725 18 4,60115716069051 19 4,60115716069051 20 4,46957360360858 21 4,41328512249549 22 4,37629784430253 23 4,32616576991108 24 4,30996473520857

Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 4 Nov. 2012
Bearbeitet: Andrei Bobrov am 4 Nov. 2012
a = randi(3456,52584,1); % a your hourly data
out = mean(reshape(a,24,[]));
  4 Kommentare
Felipe
Felipe am 12 Apr. 2017
It is the maximum value of random numbers.
Felipe
Felipe am 12 Apr. 2017
You can specify min and max values in randi function.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Raju Purohit
Raju Purohit am 4 Nov. 2012
use a "for" loop. If your data values are stored in x, then
sum = 0;
for i=1:52584
sum = sum + x(i);
end
avg = sum/i;
Hope this helps.

Community Treasure Hunt

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

Start Hunting!

Translated by