0

I have a general formula to calculate temperature gradient. It is quite old and there are better ways of doing it but I need to do it this way. I have a description of a formula for the transition between day and night that says "The transition from day to night is to be done exponentially with a time constant of 2 hours". I don't know how to accomplish this but could it be somehow along the lines of $$ \frac{dT}{dz}(t_2)_{exp} = ln((e^{\frac{dT}{dz}(t_2)}+e^{\frac{\frac{dT}{dz}(t_1)_{exp}}{(\tau/dt-1)}}+e^{\frac{\frac{dT}{dz}(t_0)_{exp}}{(\tau/dt-2)}})/3) $$ where $ \frac{dT}{dz}(t_2) $ is the "raw" temperature gradient calculated with the formula at second hour, and $ \frac{dT}{dz}(t_2)_{exp} $ is the exponentially averaged gradient at the second hour, $ dt $ is the time step (1 hour) and $ \tau $ is the time constant (2 hours). I ​know this formula doesn't work ... so I need some help or tips.. Anything is most welcome :)

The resulting "raw" values form the general formula are as follows: (sun sets right before 20 hours, in the 19th hour) | Hour | Temp. grad (raw formula) | Temp. grad exp | | ---- | -----------| ----------- | | 16 | -0.060 | resulting | 17 | -0.060 | values | | 18 | -0.010 | should | | 19 | 0.025 | go | | 20 | 0.025 | here| | 21 | 0.025 | |

Erik Thysell
  • 101
  • 3

1 Answers1

0

So, a google search for expnential smoothing did the trick. From wiki

$$ \frac{dT}{dz}(t_2)_{exp} = \alpha*\frac{dT}{dz}(t_2) +(1-\alpha)* \frac{dT}{dz}(t_2)$$

where $$ \alpha = 1-e^{^-dt/\tau} $$

and $dt$ and $\tau$ are described in the question.

Erik Thysell
  • 101
  • 3