I have 2 alternative methods to solve a problem, and I was just wondering what people who know the math better than I think, and if there is a better method to use for this type of problem.
The problem: I have a list of lat/lon positions and a value for the time interval between position updates and wish to find the SOG (Speed Over Ground). However there is some uncertainty in the exact value for each time interval - as the data is retrieved over the internet, even though in a program it would (for example) be set to request an update every 60 seconds. The data comes from an ocean racing yacht simulator, so SOG will also change with varying conditions and also with changes in course (relative to wind).
One approach is to weight new updates proportional to the length of time that interval and multiply into our current best SOG estimate. Something like this (T in seconds):
$$\text{speed} = \text{distance} / \Delta T$$ $$d = 1 - e^{-\Delta T}$$ $$\text{sog} = d * \text{speed} + (1 - d) * \text{sog}$$
And this works ok, especially if the speed is relatively consistent.
Prior to seeing this method, the one I had come up with to estimate SOG is this:
Maintain a list of the $N$ most previous {timestamp, lat, lon} tuples.
On each update, compute the harmonic mean of all possible sub intervals from $0, N-1$:
$$ S = N(N+1)/2 $$
$$ \text{sog estimate} = S / \sum_{i=0,j=i+1}^{N-1} \text{time}_{ij} / \text{distance}_{ij} $$
Then keep a list of the $M$ most previous estimates and again take the harmonic mean. $N$ & $M$ should not be too large. And obviously if there are not yet $N$ tuples to sum sub-intervals over, just use however many are available. Since the updates occur each 60 seconds, a value of 10-15 seems appropriate for both $N$ & $M$. One possible improvement I can think of is to weight each sub interval similar to method 1.
This second method seems to be more accurate than the first, although can sometimes take longer to converge on a reasonably accurate estimate - usually approximately N updates are required before it becomes accurate for any practical use.
It also seems to handle changes in 'real' SOG better, ie slight accelerations.
Given that SOG is rarely consistent over say more than 15 or 20 minutes, ie from an increase in wind strength, or change of angle to one with higher/lower boatspeed etc, and also that direction can change (again, with a change in speed), what would be the best algorithm to compute the SOG from uncertain time intervals and change in position. Also, is there a possible way to estimate the error in estimation? Even possibly correct for this error term once computed? I should mention all the data I have available: heading, lattitude and longitude, and I keep a timestamp from the beginning of each update request.
I would like to be able to compute this speed as accurately as possible.
Thanks in advance for any assistance, and forgive my poor use of MathJaX.
Edit: I get Math processing errors from MathJaX that works fine on math.stackexchange? Notice a lot of them in either questions to?? So reposted plain text math.