Arranging two different time series and averaging the data points

4 次查看(过去 30 天)
I have two different date vectors timeA and timeB recorded by two sensors A and B. TimeA is continuous while timeB is random i.e data wasn't recorded in sensor B for many hours. I need to arrange the data according to the data availability of sensor B and need to do hourly averaging. How can I approach this? Any help will be appreciated.
  2 个评论
the cyclist
the cyclist 2021-10-20
Can you upload a small subset of your data inputs in a MAT file (using the paperclip icon in the INSERT section of the toolbar), and what the expected output should be?
DS
DS 2021-10-20
This is for sensor B
The starting period of both the sensor is different i.e A starts from 2019-06-23 while B starts from 2019-06-27 and B ends at 2019-06-29 and again B starts after some days.Sensor A contains data sets like this

请先登录,再进行评论。

采纳的回答

Pranjal Kaura
Pranjal Kaura 2021-10-27
Hey,
It is my understanding that you want to combine 2 dataset based on 2 vectors 'timeA' and 'timeB', wherein you'd like to keep the data recorded by sensor B (and thus recorded in 'timeB'), which matches with the data recorded by sensor A. You then want to perform hourly averaging on the combined data.
You can combine the 2 datasets by using the 'ismember' function, wherein you can pass 'timeA' and 'timeB' as the arguments. This will give you the logical values and indices of all entries present in 'timeA', which are also present in 'timeB' (shorter dataset). You can then combine the 2 datasets using these indices. This way you can generate a combined dataset that has only those rows when sensor B was recording data.
For hourly averaging you can refer to this link. You can use the isbetween function and define ranges using 'hours'. Using this you can extract the data that has timestamps between 'x' and 'y' hours. One way to perform averaging over the whole dataset could be to iterate over all the days(i.e. group recorded data by day), and perform hourly averaging for each day.
Hope this helps!

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Holidays / Seasons 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by