D
D
Drottarutarnum2020-10-25 09:18:03
C++ / C#
Drottarutarnum, 2020-10-25 09:18:03

How to calculate the average value over time with a given step?

There is a list of structures {timestamp, val} with an unlimited number of elements and a spread in time
There may be a time range and less than a given step

Let's say I want to get an average value in increments of 10 minutes, a week or a month

For example:
1) Let the step be a month ( 30 days)
2) In the array of elements for 2 and a half months It is

necessary to get 3 elements of the array with average time and values, including the remainder (half a month)

I did not find a solution. I know that the task is not very difficult, but my aphantasy said "no", even drawing an algorithm diagram on paper did not help.

Therefore, I ask for help

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question