Calculate distance travelled with non-constant speed after time t

kinematics

Let's Imagine such a situation.
A man is walking for the first hour with a speed of $4km/h$.
The next hour he is jogging, with the speed of $9km/h$
Finally, after two hours, he starts to run, with the speed of $12km/h$

As one might expect, I want to calculate the distance which has been travelled after given time in hours $t$.

My approach to solve such a problem was to first determine, how long has the runner been going.

If it was less than one hour, his distance would be $t*V_{0}$.

If it was more than one hour, but less than two, it would be $V_{o}+(t-1)V_{1}$
Finally, if he has been going for more than two hours: $V_{0}+V_{1}+(t-2)V_{2}$

This way of doing calculations is valid and works, but I am looking for a better way which I guess must exist.
Is there any way to describe distance with a function of variable $(t)$ which is described by a single formula(Instead of three like right now)?

If it is not possible, can this be proven mathematically?

Best Answer

You can use the Heaviside function. The answer would look like $$d(t)=t[V_0H(t)+(V_1-V_0)H(t-1)+(V_2-V_1-V_0)H(t-2)]$$

Related Question