Tracking Distance on one Axis with an Accelerometer

AI Thread Summary
The discussion focuses on using an accelerometer to track distance on one axis for a rocket project, despite acknowledging that there are better methods available. The initial approach involves calculating speed and distance based on acceleration readings over time intervals. A key point raised is that the "New speed" calculated represents the speed only at the end of the interval, which could lead to inaccuracies. A more accurate method suggested involves averaging accelerations and velocities at the ends of the interval to improve calculations. The conversation emphasizes the importance of precision in tracking distance using accelerometer data.
ferret_guy
Messages
18
Reaction score
0
I need to track Distance on one Axis with an Accelerometer for a rocket project (i know there are bettor ways t do this but i am dead set on this one) I was thinking as follows,

Code:
Read Accelerometer
Accelerometer*Δt=Δv
Current speed+Δv=New speed
distance+New speed*Δt=New distance
 
Physics news on Phys.org
distance+New speed*Δt=New distance

Isn't "New speed" the speed only at the end of the interval "delta t", not for the whole duration of delta t?
 
This function is repeated many times so that is the speed that is dirived from the inatil meshurment and the Δt is the time since the last meshurment so were assuming that your travling at a constant speed for the time it takes to exicute the pice of code
 
bahamagreen said:
distance+New speed*Δt=New distance

Isn't "New speed" the speed only at the end of the interval "delta t", not for the whole duration of delta t?

Yes. It will still work, but is inaccurate. A better simple method is averaging accelerations and velocities at the ends of the interval:

PHP:
velocityX[0] = 0 // we assume the device was static when we started recording acc
positionX[0] = 0

for every sample i > 0:
    dt = time[i-1] - time[i] // if sampling rate is constant simply use 1 / frequency here
    velocityX[i] = velocityX[i-1] + (accX[i] + accX[i-1]) / (2 * dt)   
    positionX[i] = positionX[i-1] + (velocityX[i] + velocityX[i-1]) / (2 * dt)

Better is:
http://doswa.com/2009/01/02/fourth-order-runge-kutta-numerical-integration.html
 
Thank you I was hesitant about posting code because I dident know how many people wold be able to interpret it
 
Hi there, im studying nanoscience at the university in Basel. Today I looked at the topic of intertial and non-inertial reference frames and the existence of fictitious forces. I understand that you call forces real in physics if they appear in interplay. Meaning that a force is real when there is the "actio" partner to the "reactio" partner. If this condition is not satisfied the force is not real. I also understand that if you specifically look at non-inertial reference frames you can...
This has been discussed many times on PF, and will likely come up again, so the video might come handy. Previous threads: https://www.physicsforums.com/threads/is-a-treadmill-incline-just-a-marketing-gimmick.937725/ https://www.physicsforums.com/threads/work-done-running-on-an-inclined-treadmill.927825/ https://www.physicsforums.com/threads/how-do-we-calculate-the-energy-we-used-to-do-something.1052162/
Back
Top