How can I calculate speed based on previous speed?

  • Context: Undergrad 
  • Thread starter Thread starter Tim Leijten
  • Start date Start date
  • Tags Tags
    Force Speed Time
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 1K views
Tim Leijten
Messages
28
Reaction score
1
Hi,

I am developing a Train Simulator kind of program where I calculate speed each frame.
I currently do that by:
Speed = (f/m)*elapsed frames*time between frames
This works, but goes wrong when there are framerate drops or if the force changes, that's why i want to calculate the speed with the speed in the previous frame, and the time a frame took to complete.
Can someone help me with calculating speed based on the previous speed and time between frames?Thanks
 
Physics news on Phys.org
russ_watters said:
It's just a minor revision of the equation you have:
Speed = (f/m)*time between frames+ previous speed
Thank you!
 
  • Like
Likes   Reactions: russ_watters