0

I'm interested in simulating the (one-dimensional) speed and position of a car.

How can I compute the speed $v(t)$ given initial speed $v_0$, acceleration $a(t)$ (I don't want to assume that it is constant) and a drag independent of the time and dependent only of the current speed in a quadratic way, i.e., $d(t) = d_0 \cdot v^2(t)$?

I'm stuck at $v(t) = \int a(t) dt$ and don't know how I can incorporate the drag.

1 Answers1

2

I'm not sure I understood the question, is a(t) given?

If yes so write $ dV/dt+d_1V^2=a(t)$

now if a(t) is a constant you can separate variables and get $dV/(a(t)+d1_V^2)=dt$ and do integration from $V_0$ to V and $t=0$ to t here is the answer $V(0)=V_0, d_1=d_0/M$ M=mass of body

user1
  • 172
  • 1
  • 10
  • Yes, $a(t)$ is given. I could work with a constant acceleration $a(t) = a_0$ for a start. But I still don't get how I go from your answer to a formula for $v(t)$? – Jean-Philippe Pellet Mar 19 '14 at 14:37
  • And then integrate $v(t) = \int a(t) - d_1v(t)^2 \mathrm{d}t$, which can be hard, depending on $a$. Or are you simulating on a computer? – Turion Mar 19 '14 at 15:34
  • Actually, it's a differential equation, then. Assume the acceleration is constant. How do I go about solving it? – Jean-Philippe Pellet Mar 19 '14 at 16:04
  • Assuming the acceleration is constant, it is $v(t)=v_0+at$ If the acceleration is given, for this purpose you would just use timesteps: $v(t+\Delta t)=v(t)+ a(t)(\Delta t)$ That is the Euler method for doing the integral. It allows you to calculate $a(t)$ as you go, maybe based on player input. The drag just becomes one piece of calculating $a(t)$ – Ross Millikan Mar 19 '14 at 20:02