# Motion of a body given acceleration as a function of velocity

I'm having trouble figuring this out. I'm trying to determine the final time and final velocity for the motion of a vehicle over a given distance along a straight line.

$t$ is time
$v$ is velocity
$a$ is acceleration
$r$ is displacement
$m$ and $c$ are constant

Known:
$t_0$, $v_0$, $r_0$, $\Delta r$

Acceleration of the vehicle is described by:
$a=\frac{f(v)-c}{m}$

I want to derive expressions for:
$\Delta t$, and $v$

$f(v)$ is a function which returns the force which the engine can apply at a given velocity. This is essentially a lookup against a table of values from the vehicle manufacturer. I can perform an accumulation over this if required.

I'm currently estimating a result to this problem by iteratively calculating using small intervals of time.

Any help would be greatly appreciated.

-
Are these vectors or scalars? For example, is displacement the same as the distance travelled? Is the motion in a straight line? –  Paresh Feb 12 '13 at 14:59
Scalars, the motion is indeed in a straight line. –  Jack Feb 12 '13 at 15:11
@Jack What do you mean by final time? Do you mean the time at which velocity reaches some value? –  oks Feb 12 '13 at 15:53
@oks The time at which the displacement has reached some value; i.e. the travel time –  Jack Feb 12 '13 at 16:13
How are you interpolating $f(v)$ between the points in the lookup table? Is it just linear interpolation? –  Rahul Feb 12 '13 at 17:33

I think you can get much farther with explicit methods than the other answers suggest. First, given $a$ as a function of $v$, we can find $t$ as a function of $v$ by integration: $$\begin{gather} \frac{\mathrm dv}{\mathrm dt}=a=\frac{f(v)-c}m.\\ \frac m{f(v)-c}\,\mathrm dv=\mathrm dt.\\ \int_{v_0}^{v_1}\frac{m\,\mathrm dv}{f(v)-c}=\int_{t_0}^{t_1}\mathrm dt=t_1-t_0. \end{gather}$$ Since $f(v)-c$ is piecewise linear, $\int_{v_0}^{v_1}m\,\mathrm dv/(f(v)-c)$ is piecewise logarithmic and you can compute it explicitly. This gives us $t$ as an increasing function of $v$, which I'll call $\tau$: $$t_1=\tau(v_1):=t_0+\int_{v_0}^{v_1}\frac{m\,\mathrm dv}{f(v)-c}.$$ Now we get $r$ by integrating again: $$\begin{gather} \tau(v)=t.\\ \frac{\mathrm dr}{\mathrm dt}=v=\tau^{-1}(t).\\ r_1-r_0=\int_{t_0}^{t_1}\tau^{-1}(t)\,\mathrm dt. \end{gather}$$ It appears we have to integrate $\tau^{-1}$, which seems complicated. But not too complicated: let $t_0=\tau(v_0)$ and $t_1=\tau(v_1)$, and then we have $$\int_{t_0}^{t_1}\tau^{-1}(t)\,\mathrm dt=(t_1v_1-t_0v_0)-\int_{v_0}^{v_1}\tau(v)\,\mathrm dv,$$ and integrating the piecewise logarithmic $\tau$ can also be done explicitly. So now we have $r$ as another explicitly known, increasing function of $v$. Your problem amounts to finding the $v$ for the given $r$, which you will have to do via a numerical procedure, but something really simple like bisection search should work just fine.

-
This is brilliant, I'll implement this and let you know how it goes. I also have some termination conditions (like braking distance requirements), so a bisection search would have been required regardless... I think. –  Jack Feb 13 '13 at 7:46

Since $a = \dot{v}$, your equation of motion is the ODE $$m\dot{v} = f(v) - c$$

This is an autonomous first-order ODE; separating the variables gives $$m\int_{v(0)}^{v(t)} \frac{1}{f(w)-c}dw = t,$$ and if you had a formula for $f$ you could try to perform the integration on the LHS to get $mg(v) = t$, and then solve for $v$.

Since you only have numerical data, though, your best bet is numerical quadrature (which it sounds like you're already doing). For instance, pick a time step $h$ a good bit smaller than your estimated $\Delta t$, and iterate

\begin{align*} r_{i+1} &= r_i + h v_i\\ v_{i+1} &= v_i + h \frac{f(v_i) -c}{m}\\ t_{i+1} &= t_i + h \end{align*}

until $r_i-r_0 > \Delta r$.

-

You are trying to calculate $\frac 1m \int f(v)-c \; dt$ and unless you have a nice formula for $f(v)$ you will be doing it numerically, which basically amounts to what you are doing-add up accelerations times small timesteps. If $f(v)$ is reasonably smooth, you can reduce the calculation time and make it more robust by using an adaptive integration routine. Any numerical analysis text will have a discussion. I like Numerical Recipes, which is free online and has routines in C.

-

As user7530 says, you could integrate numerically by using a first order Euler method to integrate numerically

\begin{align*} r_{i+1} &= r_i + h v_i\\ v_{i+1} &= v_i + h a_{i+1} \\ a_{i+1} & = \frac{f(v_i) -c}{m}\\ t_{i+1} &= t_i + h \end{align*}

until $r_i-r_0 > \Delta r$.

But you could use different methods to integrate numerically. One way to test whether it's worth using a more complicated method would be to replace your looked up acceleration function with something that has a nice formmula for f(v), and then compare the numerical result with the exact result.

-