# Target velocity of a 1 dimensional Spring damper system

problem description

To interpolate between certain positions in a physics simulation I am trying to program, I try to use a mass-spring-damper system in one dimension.

Consider the mass-spring-damper system with mass $$m$$, spring constant $$k$$ and damping constant $$c$$ where the target position of the spring is at $$x=x_k$$, so that

$$F_{spring} = -k (x-x_k)$$

$$F_{damper} = -c v = -c x'$$

One then finds for the acceleration the differential equation

$$ma = F_{spring} + F_{damper}$$

$$x''m = -k (x-x_k) -c x' = -k x - k x_k -c x'$$

By then choosing $$c$$ and $$k$$ such that the relation $$c = 2\sqrt{m k}$$ holds I could ensure the system is critically damped so that the mass with any initial position $$x(0)=x_0$$ and initial velocity $$x'(0)=v_0$$ would approach $$x_k$$ without overshooting it.

Now, I would like to make it so that a mass with any initial position $$x(0)=x_0$$ and velocity $$x'(0)=v_0$$ will at some time $$T$$ (but not earlier) reach a target point $$x(T)=x_t$$ with velocity $$x'(T)=v_t$$.

Could one choose the value of $$x_k$$ for the critically damped system based on $$v_0$$, $$x_0$$, $$x_t$$ and $$v_t$$ such that this criterion is met? If so, what methods can be used to determine the value of $$x_k$$?

my attempt at solving it

I think the first step should be determine $$x(t)$$ and $$x'(t)$$ in terms of $$x_k$$, $$v_0$$ and $$x_0$$. This is what I have difficulty with. One could then attempt to solve $$x'(t)=v_t$$ to find a relationship between $$T$$ and $$v_t$$. This relationship could then be used to determine $$x(T)=x_t$$ to find a relationship between $$x_t$$ and $$v_t$$. One could then use this relationship to determine the value $$x_k$$ needed to satisfy the boundary conditions.

At this point, I have found $$x(t)$$ as

$$x(t)=e^{\frac{-k\cdot t}{\sqrt{km}}}\cdot\frac{1}{m}\cdot\left(x_0\cdot\left(t\sqrt{km}+m\right)+v_0mt+x_k\left(me^{\frac{k\cdot t}{\sqrt{km}}}-t\sqrt{km}-m\right)\right)$$

And $$x'(t)$$ as

$$x'(t)=e^{\frac{-k\cdot t}{\sqrt{km}}}\cdot\frac{k}{\left(km\right)^{\frac{3}{2}}}\cdot\left(\left(k\cdot t\cdot\left(x_k-x_0\right)\sqrt{km}+v_0m\left(\sqrt{km}-kt\right)\right)\right)$$

However, I have difficulty solving from here. Graphs for both equations can be found here

Any help is greatly appreciated. If there are other (simpler) methods to achieve the desired result, feel free to propose them too.