There are **three** cases here:

The acceleration is a function of time $a(t)$. Then the velocity is
$$v(t)=v_c+\int a(t)\,{\rm d}t \tag{1}$$
and the position as a function of time
$$x(t)= x_c + \int v(t)\,{\rm d}t \tag{2}$$
The distance is calculated from $x(t)$.

The acceleration is function of position $a(x)$. Then the velocity as a function of position is
$$ \frac{1}{2}v(x)^2 = w_c + \int a(x)\,{\rm d}x \tag{3}$$
and the time as a function of position
$$ t(x) = t_c + \int \frac{1}{v(x)}\,{\rm d}x \tag{4}$$
which needs to be back-solved for $x(t)$.

- Lastly, the acceleration is a function of velocity $a(v)$. Then the time as a function of velocity us
$$ t(v) = t_c + \int \frac{1}{a(v)}\,{\rm d}v \tag{5}$$
and the position as a function of velocity is
$$ x(v) = x_c + \int \frac{v}{a(v)}\,{\rm d}v \tag{6}$$
which need to be back-solved for $x(v(t))$

_{Where $x_c$, $v_c$, $t_c$ and $w_c$ are integration constants of appropriate units}

**Example 1**

$ a(t) = -100 \sin(10 t)$, with $x(0)=0$ and $v(0)=10$
$$ v(t) = \int -100\sin(10 t)\,{\rm d}t = 10\,\cos(10 t) $$
$$ x(t) = \int 10\cos(10 t)\,{\rm d}t= \sin(10 t)$$

**Example 2**

$ a(x) = -100 x$, with $x(0)=0$ and $v(0)=10$
$$ \frac{1}{2}v(x)^2 = \int -100 x {\rm d}x = 50 (1-x^2) $$
$$ v(x) = 10 \sqrt{\left(1-x^2\right)} $$
$$ t(x) = \int \frac{1}{10 \sqrt{\left(1-x^2\right)}}\,{\rm d}x = \frac{\sin^{-1}(x)}{10} $$
$$ x(t) = \sin(10 t) $$

**Example 3**

$ a(v) = 100 - 5 v $, with $x(0)=0$ and $v(0)=10$
$$t(v) = \int \frac{1}{100 - 5 v}\,{\rm d}v = -\frac{1}{5}\ln{ \left( \frac{20-v}{10} \right) } $$
$$x(v) = \int \frac{v}{100 - 5 v}\,{\rm d}v = 2-\frac{v}{5}-4 \ln{\left(\frac{20-v}{10}\right)} $$
with solution $v(t) = 20-10 \hat{e}^{-5 t}$ and $x(v(t)) = 2 \hat{e}^{-5 t}+20 t-2 $

I can't see a good way to answer your question without some more data.

I tried fitting a quadratic and cubic to your distance time data, and both give pretty good fits, but the fitted velocity at the 400m point is around 8m/sec so it's a big extrapolation down to 2m/sec. In fact the quadratic and cubic fits diverge quite strongly beyond about 450m so I wouldn't trust either of them.

I think the only good way to estimate the time to 2m/sec is if you know a specific mathematical model underlies the motion. If this is coursework there may be some hints about what model they expect you to use. If it's a real life example I think you'd be bold to assume any particular model. As I recall, resistance tends to go as $v^2$ at high speeds and switch to $v$ at low speeds, with an additional constant (i.e. independant of velocity) resistance due to friction in the drive train. But the details will depend on the car.

If you want the fits (fitted using Excel) they are:

$$ s = -0.1148t^2 + 15.596t + 1.4563 $$
$$ s = 0.0017t^3 - 0.201t^2 + 16.64t + 0.0021 $$

**Later**: I'm probably taking this further than the data supports, but if you assume the deceleration is proportional to $v^2$ you get $v \propto 1/t$ and hence $s \propto ln(t)$. If I fit a function of this form to your data I find the following gives a pretty good fit:

$$ s = 577.5 \space ln(t + 34.1) + 2038 $$

The point of this fit is that it's physically motivated while the fits above were purely numerical. Anyhow, differentiating this to get the velocity gives:

$$ v = \frac{577.5}{t + 34.1} $$

So if you're prepared to assume the deceleration stays proportional to $v^2$, the car reaches 2 m/sec after 255 seconds.

**Response to comment**: I can only speak as an (ex) experimental physicist, but faced with some data the first thing I would do is graph it and see what the curve looks like. Experience often immediately tells you what the functional form is e.g. whether it's a parabola, hyperbola, exponential etc. However in this case nothing obvious sprang to mind.

The next step is to fit a few random functions and see if anything looks plausible. Excel has a polynomial fit built in. Graph your data as a scatter plot then right click the curve in the graph and select "add trendline". Select the type of fit, then on the options tab click "include formula" or you'll just get the line and not the fitted equation.

In this case the polynomial fit didn't shed any light, so you have to get out the pencil and paper and try to work out a physically reasonable description. Wikipedia will tell you that at high speed air resistance goes as $v^2$, so a reasonable guess is that the retarding force is proportional to $v^2$. I used my polynomial fits to calculate $v$ and $a$ from your data. With only five points the results were pretty noisy, but it did look as if a 2-fold change in velocity did cause a 4-fold change in acceleration so the $v^2$ dependance looked plausible.

So the equation of motion is something like:

$$ \frac{dv}{dt} = -A \space v^2 $$

for some constant, $A$, and the solution to this is:

$$ v = \frac{B}{t} $$

for some other constant $B$, i.e. velocity falls of as 1/time. This function for $v$ says that $v$ takes infinite time to fall to zero, but we expect it only applies at high speeds so that's OK. Since $v = ds/dt$ we integrate the expression for $v$ to give the logarithmic dependance of distance on time.

The equation I used:

$$ s = a \space ln(t + b) + c $$

is just the most general form of the equation for $s$. I went back to excel and graphed the data along with an extra column for the log equation, then I manually adjusted the values of $a$, $b$ and $c$ to get a rough fit.

At this point I used an Excel add-on called the Solver. I won't go into how to use this because it's quite fiddly and there are lots of articles on how to use it out there in Googleland. The solver can adjust variables you specify to get the best fit of your function to data, and that gave me the equation I posted.

On last comment, extrapolating data is always dangerous because you have to assume that whatever equation you use applies outside the range of data you've collected. The velocity in your data falls from about 16 m/sec at $t = 0$ to about 8 m/sec at the last point in your data, and it's a large extrapolation to try and extend this to 2 m/sec. I doubt that the $v^2$ dependance of deceleration would apply down to 2 m/sec so my calculated value for the time taken to decelerate to 2 m/sec is probably much too high.

## Best Answer

The accelerometer measures the negative of gravity plus any upwards acceleration

^{see NOTE#1}$$ acc = -(g+\ddot{x}) $$

and you want to integrate $\ddot{x}$ to get speed $v=\dot{x}$ and position $x$. So your expressions should be

$$v(t)=-\int_0^t ( acc+g)\,{\rm d}t \\ x(t)=-\int_0^t \int_0^t ( acc+g)\,{\rm d}t\,{\rm d}t$$

You also know that the final position should be equal to the initial, and the final velocity should be at rest. This requires you to tweak the integration results to get the desired result. This can be justified since you have discrete acceleration values This is where you calibrate the model with the measurement data.

So here are the steps to take

over timefrom zero time and note the final velocity $v_1$ and time $t_1$ in the end.^{see NOTE#2}$$v(t)=\int_0^{t} -( acc+g) + \left( \frac{2 v_1}{t_1} - \frac{6 x_1}{t_1^2}\right) + t \left(\frac{12 x_1}{t_1^3}-\frac{6 v_1}{t_1^2}\right) \,{\rm d}t \\ x(t)=\int_0^{t} \int_0^t -( acc+g) + \left( \frac{2 v_1}{t_1} - \frac{6 x_1}{t_1^2}\right) + t \left(\frac{12 x_1}{t_1^3}-\frac{6 v_1}{t_1^2}\right) \,{\rm d}t\,{\rm d}t$$NOTE #1:To get the accelerometer equation you need to do a free body diagram on the accelerometer itself as it is attached to the phone and follows the phone's motion. The connection force $F$ is sensed used piezoelectic materials such that $F - m_{acc} g = m_{acc} \ddot{x}$. The reported acceleration is calibrated to be $$acc=-\frac{F}{m_{acc}} = -g -\ddot{x}$$ such that an upwards reaction force indicates downwards acceleration (the so called D'Alembert rule). Note that initially when $acc=-g$ the result is $\ddot{x} = -(-g)-g = 0$.NOTE #2:You can verify that$$\int_0^{t_1} \left( \frac{2 v_1}{t_1} - \frac{6 x_1}{t_1^2}\right) + t \left(\frac{12 x_1}{t_1^3}-\frac{6 v_1}{t_1^2}\right) \,{\rm d}t =-v_1\\ \int_0^{t_1} \int_0^t \left( \frac{2 v_1}{t_1} - \frac{6 x_1}{t_1^2}\right) + t \left(\frac{12 x_1}{t_1^3}-\frac{6 v_1}{t_1^2}\right) \,{\rm d}t\,{\rm d}t = -x_1$$