Is a sigmoid function what I need to make this graph?

533 Views Asked by At

I'm designing a game where characters' speed starts slowing down after different distances. I'm not advanced in mathematics so I'm not sure if I'm on the right track. After researching on wikipedia I found information on Gompertz function and Sigmoid function. My primary question is if one of these are the formula I need or is there a simpler way to describe what a characters speed will be?

Here is a graph of the dynamic.

To be specific: The max speed a character can have is $32$m/s, the minimum is $16$m/s. The most unfit character starts to slow down immediately from $32$m/s to $16$m/s in $16$ seconds. The most fit character doesn't start slowing down until after $16$ seconds. The variable of when the slow-down begins can fall anywhere between $0$s and $16$s of travel. Would be awesome if someone could show what the formula would look like for this.

1

There are 1 best solutions below

2
On

Here's a "modular" explanation, in the hopes that you can easily modify (if necessary) it to suit your needs.

Let $S$ (for speed) be a function satisfying $0 \leq S(t) \leq 1$ for all real $t$; $S(t) = 0$ for $t \leq 0$; $S(t) = 1$ for $1 \leq t$.

The "cubic interpolation" is probably smooth enough to suit your needs: $$ S(t) = 10t^{3} - 15t^{4} + 6t^{5} = t^{3}\bigl(10 + t(-15 + 6t)\bigr),\quad 0 \leq t \leq 1. $$ (The rightmost expression is called Horner's form, and minimizes the number of multiplications needed for algebraic evaluation.)

If a character starts at speed $s_{1}$ at time $t_{1}$ and ends at speed $s_{2}$ at time $t_{2}$, their speed at time $t$ can be modeled by $$ s_{1} + (s_{2} - s_{1})S\left(\frac{t - t_{1}}{t_{2} - t_{1}}\right). $$