1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

I Find Vertical Displacement

  1. Dec 24, 2016 #1
    I'm doing a program for the simulation of some experimental data.
    The data is recorded by a device and that the register are the:
    - acceleration components along the (x, y, z),
    - time (starting from 0, and change of each recording Delta t),
    - orientation (azimuth, roll, pitch).

    My goal is to be able to extrapolate a graph (elevation, time), the data is recorded by a device inside a passenger compartment, with the y-axis pointing upwards.
    I read a lot about projectile motion, I think it's what I have to simulate substantially.
    So for the calculation of the elevation, I would have thought to apply this formula:
    vy = V_{iy} t + 1/2} a_y t^2
    I thought to derive the speed through the Euler method, since dispose of acceleration and time data.
    From this speed I should now extrapolate the vertical and horizontal speed, and if I understand correctly, the formula should be:
    V_iy =V_i * sin (Φ)
    the problem for me is to calculate precisely the angle Φ.
    There is a way to calculate this angle?
  2. jcsd
  3. Dec 24, 2016 #2


    User Avatar
    Science Advisor
    Homework Helper
    2017 Award

    Hello Pasquale, :welcome:

    Since your device also registers the acceleration in the x direction: you can analogously integrate to get the speed in the x-direction. Your azimuthal direction (if that is really what you mean with ##\phi##) has tangent ##v_y/v_x##.

    Note: the ##v_y = V_{iy} t + {1/2} a_y t^2## is utterly wrong. Check the dimensions! The proper expression is ##y(t) = y_i + V_{iy} t + 1/2 a_y t^2##.
    For the velocity you have ##v_y(t) = v_{i,y} + a_y t## etc.
  4. Dec 26, 2016 #3
    Thanks for the answer, but I could not even get the desired result, I try to explain better my problem.
    I register with a smartphone inside a vehicle, the data of the accelerometer, orientation and time.

    From the vertical acceleration signal like in the image:

    They should be able to pull out a chart (elevation, time), that Approximately give me a profile of the road pavement.

    Because I need to figure this elevation for each point where making a recording so any deltaT ##(tn-to) / N##
    My problem appears to be to understand the angle of elevation of the car compared to the asphalt in the presence of irregularities.
    What I did for iteratively repeating the calculation process, was from an initial speed condition and displacement of 0.
    ##v0 = 0##.
    ##s0 = 0##.
    And I calculated the deltaT, of the recording interval:

    ##deltaT = time (1) - time (0)##.

    These since my disposal of accelerometers data I tried to calculate the speed and displacement for each point (t + 1):
    ##v(t + 1) = v (t) + ay(t) * deltaT##;
    ##s(t + 1) = s(t) + v(t) * deltaT + 0.5 * ay(t) * deltaT ^ 2##.

    But what I get is a graph of this type:

    that's not really what I expect. So I wanted to find a way to be able to calculate the car's corner at any time t. in such a way as to obtain the correct vertical acceleration for find vertical displacement. But i don't know how can do it.
    Last edited: Dec 26, 2016
  5. Dec 26, 2016 #4
    The problem is your second step. Drop the 1/2 a t^2. That is already included in v(t).

    Let me try to explain. You are thinking of the expression under constant acceleration

    x(t) = x(0) + v(0) t + 1/2 a t^2

    Note that the v(0) is a constant and is the velocity at zero time. Now think about where 1/2 a t^2 comes from. At constant acceleration v is the integral of a over time:

    v(t) = v(0) + a t

    and x is the integral of that and that gives the 1/2 a t^2. It IS the integral of v(t).

    With varying acceleration you are doing these two steps expressly and serially. The integration of a to get v(t) is already included in your v(t). So your integration of v(t) to get x already includes the part you think of as 1/2 a t ^2. There is no other term. Also, with no better information you should assume x(0) is 0 and v(0) is 0

    so you fist step
    v(i)=v(i-1) + a(i) dt
    is good. The second step should be
    x(i)=x(i-1)+v(i) dt

    You can quibble over what part of each interval had what acceleration and which speed and perhaps make an average speed for the interval, but it won't change the result much.
  6. Dec 26, 2016 #5
    Thanks, i drop the ##0.5 * ay + deltaT^2##.
    The result, however, seems to be almost equal as you have just told me.
    That I can not understand is whether applying the procedure, what you get is the actual car's vertical displacement or less.
    Graph I get is almost similar to what I posted before and values between them are always one larger than the other, but I was expecting something similar to graphic acceleration, or was left around of the values, and in the vicinity of peaks of acceleration, find the elevation peaks.

    Forgive me for these questions, but I did not understand and I'm looking for explanations to solve this problem.
  7. Dec 26, 2016 #6


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Does the accelerometer read zero when there is no acceleration? Try recording some data with the phone stationary on the desk. Any offset will cause a constant drift in the vertical displacement.
  8. Dec 26, 2016 #7
    It doesn't read zero perfectly when there is no acceleration (I think it's due to vehicle vibrations), but values which are very close to zero, as the recording is very high frequency (100Hz).
    The recording is done at the moment with the phone attached to the car dashboard.
  9. Dec 26, 2016 #8


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    While googling for data on smart phone accelerometer offset I found a reference to this video. At around 23:20 it discusses working out position (eg displacement) from acceleration using double integration. In short any error in orientation causes problems when you subtract g to get the actual acceleration. This creates an offset that when integrated causes a large drift (a graph just like you got). I think he says that a 1 degree orientation error gave him a 5m/s drift in position.

    Last edited: Dec 26, 2016
  10. Dec 26, 2016 #9


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    One possibility might be to arrange your software to correct for orientation error. For example after the phone is fixed to the dashboard (engine off) you know that the vertical acceleration should be zero. So instead of simply subtracting 9.81m/s^2 to zero the output instead record a few seconds worth and calculate the average value needed to zero the output. That should correct for any error in mounting the phone exactly level.
  11. Dec 26, 2016 #10
    Another approach is to force the end points to be at the same elevation. Drive a route that ends where it started and then remove the accumulated error assuming it is a constant drift by subtracting a straight line that passes through the end points.
  12. Dec 28, 2016 #11
    Thank you both for the answer.
    I'll try to follow your advice, I think that the result depends strongly from the error that I get to the base, as well as try as you said, I think to change approach, and then, or not to use the Euler method, or had read about the Fast Fourier Transformation (FFT).
  13. Dec 28, 2016 #12
    I read also that for remove noisy is possible applicate a Kalman-Filter, now i'm very confuse :/

    If i start to reading my data during the travel.
    When i finish i would to process my data, to obtain a final vertical displacement graph as i said, with only euler method i noticed that
    it is impossible to have an adequate result.
    I should first remove the noise from the data, and to do that I read that a way could be applicate the kalman filter,
    if the approach might have been okay, then I should get the "clean" data, and these should apply the double integration techniques (Euler method, Runge Kutta, for example), the result could be far more true and real?
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted