I'm completely certain that I'm re-inventing the wheel, but struggling to think of search terms to make progress, so please bear with me.
I'm gathering a person's location track in an app, and want to work out an averaged speed of what will be noisy GPS data. In order to smooth out the noise I have come up with several different ideas in terms of complexity, but other than the most basic two I have holes in my mathematical understanding of each:
1. Simple long average
Record location every second, measure the distance between the current location and the location 10 seconds ago. If the two points are at the extremes of some noise so will my speed be - it doesn't really do that much smoothing.
2. Moving average
Again, record the location every second. Then work out the speed between each point, and average that over the previous 10 seconds or so.
This will smooth out bigger bumps, but may still exaggerate data such as that shown here. Any average that includes the 57mph and 70mph segment will obviously be inflated.
3. Linear Regression
Find a trend line and fit it to the data - assuming the data is plotted in lat/long/time co-ordinates
Data grouped for trendline(not enough rep for an image - are people able to edit?)
This then spits out a the parameters of a line that's got "slope" and "intercept". I then have two issues:
- poor fit for curved tracks
- I think the speed is the slope, but what are the units? a degree of latitude isn't the same number of miles as a degree of longitude!
4. Polynomial Regression
I can fit an nth degree polynomial line to the co-ordinates, thereby taking a smoothed path through space. Taken over a small enough time there's not much chance that the person is zig-zagging back and forth, so 2nd degree should be fine - I'll end up with something like this:
I then am completely stuck with the maths - what relates to speed?
5. Kalman Filter applied to instant speed
Having read a few of the suggested links Some mention in passing Kalman Filters but reading the wikipedia page it seems that the filter needs to know what kind of data to expect.
How do I train it? Guess the parameters? Upload a load of data somewhere and get the parameters back?