Need help with an algortim to estimate current speed/rate

statik213

Golden Member
Oct 31, 2004
1,654
0
0
Given the times at which certain an object passes multiples of a fixed distance, what's a good algorithm to calculate the current speed of the moving object?
the data stream might look like this :

(time, distance)

(0,0)
(4,5)
(9,10)
(14,15)
(20,20)
(25,25)
(29,30
(35,35)
(41,40)


..
so how can I tell how fast the object is moving at time t=42,43,44 etc... ?
Now, the easiest way is to sum the distance travelled between the last n data points and divide by the time taken.
another way, would be to get the instaneneous velocities at each point and use a moving average filter using the last n data point.
but, what would be a better way of doing this? the above data is basically all I'll have, I don't know what the total distance 'travelled' would be.
the scenario is pretty similiar to measuing file transfer rates, are there good file transfer speed measurement algorithms that I can adapt for this scenario?

also, should this be posted in highly technical instead?

edit:
this is not HW :)

 

BigPete

Senior member
May 28, 2001
729
0
0
I am not sure of the answer to your question but I seriously doubt this is highly technical. This seems like the right forum.
 

Drakkon

Diamond Member
Aug 14, 2001
8,401
1
0
its a simple line calculation algorithm...your given a selection of points now create a linear regression through them...
this sounds eerily like hw though so prolly should've give you any more info than that :p
 

statik213

Golden Member
Oct 31, 2004
1,654
0
0
Originally posted by: Drakkon
its a simple line calculation algorithm...your given a selection of points now create a linear regression through them...
this sounds eerily like hw though so prolly should've give you any more info than that :p

it's not HW :)

well, i'm not sure if the data will always be linear, and I'd like to weight the more recent data more than the older data...



 

Drakkon

Diamond Member
Aug 14, 2001
8,401
1
0
search "line of best fit", its a statistical representation based on the points given such that you can plug in an x and get a y, its got a statistical deviations but its approximating based on points given. You can also find algorithms to do it through polynomials with degree 2,3,4,5,...x depending on how acurate you want to get.