Android Question Calculate average speed

marcel

Active Member
Licensed User
Longtime User
Hi,

How do you calculate the average speed you are driving? I want from a start point continues display the average speed until the end point (about 3 km).

How do you calculate this, do I need to push every time I get a location update the speed to an array and from the start of the array until the end calc the average or is there a smarter way?
 

Zakerg

Member
Licensed User
Longtime User
If you can continuously update distance traveled in real time and divide it by elapsed time you would always have the average speed and not require an array unless you wanted to compare the average speed of various segments.

Taking a distance reading at every .25 km would give you the average speed from start to that segment except the display of the average speed would remain fixed until you hit the next .25 km update. Assuming you use total distance to the update point, you should not need an array unless you want to compare segments.
 
Upvote 0

marcel

Active Member
Licensed User
Longtime User
But then you assume that the way is always straight and no curves. I did this before and was not very accurate.
 
Upvote 0

eurojam

Well-Known Member
Licensed User
Longtime User
this depends more or less, how you determine the distance between two points (start and end point). If you can measure the real distance traveled and divide it by the travel time you will always have the correct average speed like marcel pointed out...
 
Upvote 0

Zakerg

Member
Licensed User
Longtime User
I did not assume the road was strait or curved. The time and distance calculation is the average speed to cover that distance whether it is strait or curved. A device that did a continuous average speed may show a lower average speed at the end of a curve and a higher average at the end of a straight away but the final reading at the end of the 3 km is the final accurate average speed.

If you want to analyze your speed through curves and straightaways on the course then you would break it into segments. If break the course into 6 segments and have an average speed for each segment you cannot add the 6 averages and divide by 6 that would give you an average of averages which would likely be different than the average speed you get by dividing total distance by total elapsed time. Perhaps this was the cause of the inaccuracy you mentioned.
 
Upvote 0
Top