Tmax =
, interval =
sec.
u =
* x +
* vest. No limit on the drive
tnext){ tnext=tnext+interval; vest=(x-xold)/interval; u = kx*(x - xtarget) + kv*vest; //This calculates the drive xold=x; } MoveTo(t,x); x = x + v*dt; //This is the simulation v = v + b*u*dt; t = t + dt; Colour("black"); LineTo(t, x); Colour("blue"); Spot(t,v); Colour("gray"); Spot(t,u); Colour("green"); Spot(t,vest); if(t