views:

421

answers:

5

My bike computer can show me various figures such as distance travelled, time elapsed, max speed, average speed, current speed etc. I usually have it set to display the current and average speeds.

You can reset the distance and time (both together) at any point; the max and average speeds are calculated since the last reset. The distance is taken from the wheel sensor (you have to calibrate it initially to tell it the circumference of your wheel) and the time is from its own real-time clock.

Now, quite often while I am cycling along, I will be going at well above the displayed average speed and yet the average speed shown will go down. As a concrete example, this evening I was cycling home and my current speed was holding steady at 19.5 mph; my average was showing 12.6 mph and as I looked at it, it clicked downwards to 12.5.

What I'm trying to work out is what kind of bizarre averaging algorithm it is using that can give this effect. I can't believe it's doing any kind of fancy stuff other than total distance / total time. I guess it must be some sort of rounding / boundary condition but I can't work out what. Any suggestions?

[I asked this around the office at work but nobody had any ideas other than that I should stop worrying about these sorts of details! Hey, I have to think about something when I'm cycling, it's 9 miles each way...]

+15  A: 

I'm going to guess that it has a history of a certain number of data points and displays the average over them. As time goes on the older points are pushed off.

If you were going faster at the point far enough back to be the end of the history pushing off a point will lower your average.

Loren Pechtel
I agree, I think there is a historical boundary condition that you hit.
Adam Nelson
Just to add a little bit of insight as to why the bike would use a moving average: imagine that you ride your bike all the time, and your speeds are consistently getting better and better. If the bike used a non-moving average, your progress would appear to be artificially slowing down as a result of the number of data points constantly increasing, even if in reality your progress were quite steady.
Dan Tao
I don't believe it is a moving average. Trip average is a) easier to compute. b) More interesting to me as a cyclist. The reset button prevents the 'slowdown effect' Dan mentions.
AShelly
You HAVE to have a moving average because if you don't, eventually your speed becomes a single value that gets hard to change no matter what you do. It should do the trip thing as well, but after some time might revert to using less data points than the entire trip. Besides, when you think about the real name for it--a "Rolling" average--of course that's what a bike computer would use.
Bill K
Yes, a bike computer has a moving average - it's called 'Current Speed', and the window is pretty small - ~1 second I'd guess. That's the one the OP describes as "holding steady @19.5". But I'm sure the "bizzare" one is the 'Trip Average', which should be distance/time since reset. And yes, if you never reset, it will eventually steady state.
AShelly
I don't believe it can be a moving average - why on earth would you implement a buffer of samples requiring a) storage and b) more calculation when you can just divide distance by time to get the average speed? I think the "current speed" is a very short rolling average, but I can't believe the "average speed" is calculated that way. I do agree it would explain the effect I see, but I think AShelly's answer is more likely to be the real answer, so I'm accepting that one.
Vicky
+4  A: 

It's really a motivational technique.

samoz
A: 

It's timing between rotations of the wheel but it can easily miss a pass of the magnet over the sensor because of a bump in the road or noise.
So you measure a speed half the correct value for that one data point, it then does a running average so that bad point pollutes the speed for the next few revolutions.

Martin Beckett
That's a reasonable explanation for how the device might do the 'current speed' reading. But it should not need to use a running average to calculate trip average speed, only total distance/total time.
AShelly
A: 

The system needs to sample at some (probably constant) rate.

In order to compute a moving average it only stores at most N datapoints.

So in order to update the average it must drop one of its stored points to get a new average, and if the dropped point was faster than your current speed, the moving average would drop.

plastic chris
whoops, didn't see other answers till I submitted. Must have had the tab open awhile. Sorry for the duplicate.
plastic chris
+6  A: 

It's not a running average, it's supposed to be the average for the whole trip, right? At least that's what I always assumed mine was doing.

I've noticed that effect too. My theory is that both the clock and the distance counter it uses for the average have a fairly low resolution, so sometimes the clock counter ticks up while the distance counter stays steady, and you get the dip. For Example:

dist time   spd
8.5 40.1   12.72
8.5 40.2   12.69

If they are using an integer processor and fixed point, truncation would make the drop appear even larger

AShelly
I think this must be the right answer - thank you!
Vicky
Also, it takes some time for the bike computer to time out between the times that the magnet passes the sensor.
Tobias Wärre