I need to calculate a trend...

... And I suck at maths :cold_sweat:

I have a sketch collecting temperature samples and putting them in an array of 12 rows every 5 minutes. Now I would like to be able to calculate a trend from these samples to know if temp is rising, falling or steady over the last hour.

Any ideas how to do that?

Thanks!

I'll calculate average "1 hours" value, summing up 12 digit and divide a sum by 12. S(i) = ( T1 + T2 +....+T12 ) / 12.
Than trend is a differential of two S, current and previous:
if ( S(i-1) > S(i) ) trend = "Down";
if ( S(i-1) < S(i) ) trend = "Up";
if ( S(i-1) == S(i) ) trend = "Steady";

You need to do a "linear regression".

Like I said, I suck at maths.
I used Magician's method and it works. Thanks!