I was looking at some source code that was described as 'maintaining a moving average over the previous 10 minutes', and noticed it uses the exponential function. Now its been a while since my university study, and i didnt take as many numerical analysis type math topics as I wish I had (mostly vector calc and diff equations), but I cannot undertand how this algorithm works and I really would like to:
Geodesic g = new Geodesic(lat1, lon1, lat2, lon2);
double t = (cal.getTimeInMillis() - ts.getTimeInMillis()) / 1000.0D;
if (t > 0.0D)
{
double s = 3600.0D * g.distance() / t;
if ((0.0D != sog) && (0.0D != s))
{
double d = 1.0D - Math.exp(-t / 600.0D);
sog = (d * s + (1.0D - d) * sog);
}
else
{
sog = s;
}
}
Basically position is updated every minute or so, with some uncertainty in the exact time values between the actual updates, hence some averaging over time is needed, I just can't figure out how the 2 lines within the if() statement a acheive that.
The only link I can think of that may have relevance is that the 1st derivative of ln(x) is 1/x.