1
$\begingroup$

What I'm essentially doing is Kalman Filter. If anyone is familiar with (but it doesn't really matter in this case). Consider the following formulas:

$$x_k=x_{k-1}+v_{k-1}dt+a_{k-1}\frac{dt^2}{2}$$

$$v_k=v_{k-1}+a_{k-1}dt$$

$$a_k=a_{k-1}$$

where $p$ is position, $v$ is velocity and $a$ is acceleration. The above model represents the movement of a vehicle... Why is acceleration taken into account, both in position and velocity? And why is it in position $\frac{dt^2}{2}$?

$\endgroup$
4
  • 1
    $\begingroup$ This looks like a velocity verlet. Not for the position but velocity. en.wikipedia.org/wiki/Verlet_integration#Velocity_Verlet $\endgroup$ Commented Sep 3, 2012 at 6:59
  • $\begingroup$ Are you making a simulator? $\endgroup$ Commented Sep 3, 2012 at 7:00
  • $\begingroup$ Hm, so this is purely mathemathic/physic - no intuitive explanation what that does? No, I'm just learning Kalman Filter and need to know the model. $\endgroup$
    – c0dehunter
    Commented Sep 3, 2012 at 7:04
  • $\begingroup$ Lubos gives a physical answer below, but the second order correction $a_k\,dt^2/2$ may also help the Kalman filter - I'm guessing $a$ is a parameter being estimated by the filter? $\endgroup$ Commented Sep 24, 2013 at 14:01

1 Answer 1

2
$\begingroup$

As written down, your code describes a motion with constant acceleration (see $a_k=a_{k-1}$), so the trajectory will simply be a quadratic function (parabola).

Every moment $dt$, the velocity changes by the obvious amount, $dt\cdot a$. The same is true for position which changes by $dt\cdot v$ but there is an extra piece $a/2\cdot dt^2$ in the change of the position. This term is infinitely smaller than the main term, $dt\cdot v$, and if $dt$ is short enough, you may neglect it.

However, if you include it, you get a higher accuracy of the simulation even if $dt$ isn't too small. Why? Because the change of the position $p$ during the time $dt$ is calculated as $dt$ times the average velocity in this short time interval. And because the velocity is changing approximately linearly, the average velocity is $$ \overline v = \frac{v(t)+v(t+dt)}{2} = \frac{v(t)+v(t)+a(t)dt}{2} = v(t)+\frac{a(t)dt}{2} $$ If you multiply this $\overline v$ by $dt$, you get the change of the position $p$ as incorporated to your first equation.

$\endgroup$
2
  • $\begingroup$ So with that part you basically compensate for the error that is produced by averaged velocity? $\endgroup$
    – c0dehunter
    Commented Sep 3, 2012 at 7:23
  • $\begingroup$ With that part, we change the position by $dt\cdot \overline v$ where $\overline v$ is the average velocity over the following interval $dt$, while if we had omitted the extra term, we would be using the initial velocity of the interval, one which will be somewhat inaccurate at the end of the interval. $\endgroup$ Commented Sep 3, 2012 at 7:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.