Calculating an average week with datapoint every 15 minutes

2 Ansichten (letzte 30 Tage)
Thomas Steip
Thomas Steip am 18 Dez. 2020
Beantwortet: Rishabh Mishra am 21 Dez. 2020
I have a dataset with values every 15 minutes for 3 months and I need to compute a dataset for the average week.
This means with each data point being the average of all the data points at the same time. (For example the data point of the average week at monday 12:15 is the average of all data points at monday 12:15 during the 3 months)
Does someone know a way to do this?
Attached is the dataset over the three months and the corresponding datetime dataset.

Antworten (1)

Rishabh Mishra
Rishabh Mishra am 21 Dez. 2020
Hi,
Use the code below to find the average values recorded at 00:15 on all the Mondays in the given datetime array.
load NO2_roadside_replaced.mat;
load t.mat;
% find indices for datetimes with day = Monday & time = 00:15
% Weekday of Monday = 2
% Hour-value of time = 0
% Minute-value of time = 15
index = weekday(t) == 2 & hour(t) == 0 & minute(t) == 15;
% Find average ignoring NaN values
avg = nanmean(NO2_roadside_raw(index));
Similarly use the same code to generate remaining data points.
Hope this helps.

Kategorien

Mehr zu Dates and Time finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by