0

I have the following problem:

I have a 2D-array that looks like this:

#Time in Minutes     Temperature in °C:
0                     15
2                     16
4                     16
...

I have about 12,000 datapoints, each ~2 minutes apart. I want to calculate the rate of temperature change. I'm aware of np.diff, but don't see how that can help me, since the changes between each measurement are usually only +/- 1 °C, since my temperature feed only provides integer values.

Hope this makes sense. Thanks in advance, Nico

Nico
  • 21
  • 3
  • how do you define the derivative? If the temperatures at times (0, 2, 4) are (10, 11, 12) respectively, what would be the derivative at time 2? – Roy2012 May 24 '20 at 09:35
  • Usually the derivative is delta_y / delta_x. Thus, my guess would be, to just calculate those deltas. Therefore, the derivative between 0 and 2 is (11-10)/(2-0) = 0.5. I don't think there is a numpy function. This is basic list comprehension. – Rennnyyy May 24 '20 at 09:37
  • Does this answer your question? [How do I compute the derivative of an array in python](https://stackoverflow.com/questions/16841729/how-do-i-compute-the-derivative-of-an-array-in-python) – Georgy May 24 '20 at 09:48
  • @Rennnyyy - I don't think this makes sense. Consider times (0,2,4) and temperatures (10, 11, 11). When calculating the derivative for time 2 - do I need to take into account the difference between time 0 and time 2 (one degree), or the difference between time 2 and time 4 (zero degrees)? It seems like the derivative at time 1 would be what you've described above. – Roy2012 May 24 '20 at 09:52
  • 2
    Well from theoretical point of view, the function is not differentiable because there is at least one point (e.g. 2) where the left and the right derivation does not equal. Thus, you will have to find your own "interpretation" for what the derivative means at that spot. However, in the open interval (0, 2) the derivative is 0.5. – Rennnyyy May 24 '20 at 10:05
  • What about first fitting a function to this set and then finding a derivative? The concept of a derivative is limited to continuous functions. In this case, you may obtain forward/central/backward finite differences. Whichever you might choose to run with, you have to consistent in the entire dataset. – amzon-ex May 24 '20 at 10:19

0 Answers0