Collapse monthly data to yearly
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
desert_scientist90
am 27 Sep. 2019
Bearbeitet: jeewan atwal
am 27 Sep. 2019
Hi All,
I have a large data set with weather observations for 50 years. I am trying to calculate the mean values for each month in order to have a historical trend of the temperature as function of the month. I am new to matlab is there a way to do this?
0 Kommentare
Akzeptierte Antwort
jeewan atwal
am 27 Sep. 2019
Bearbeitet: jeewan atwal
am 27 Sep. 2019
Assuming 30 days in a month and 1 year consists of 12 months. So total temperature values for 50 years would be 30 x 12 x 50 = 18000.
Now lets say we store these 18000 values in a vetor A whose dimension would be 18000 x1
A= [ ] 18000 x1
Next step is to find temperature mean for each month. This can be done using for loop and mean command as follows:
Let N = 12 x 50 = 600
k=1;
for i=1:N
y(i) = mean (A(30*(k-1)+1:30*k));
k=k+1;
end
plot(1:N, y)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Time Series Events finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!