Equation for a smooth step function

$\begingroup$

The equation must be smooth and satisfy the following two conditions:

  • When $x \leq -10, y=-50$
  • When $x \geq 10, y=50$

Is there an equation (or multiple equations) that lets me graph a curve that looks like that?

$\endgroup$ 1

3 Answers

$\begingroup$

The sigmoid function, $S(x) = \frac{1}{1+e^{-x}}$, achieves close to what you need (with appropriate scaling and shifting of the function).

Do you need the function to be exactly $\pm 50$ when evaluated at $\pm 10$? If so, a polynomial option would be to use something called the smoothstep function, built using the function $f(x) = 3x^2-2x^3$. Modified to your problem, the desired function, denoted by $g(x)$, is$$ g(x) = \begin{cases} -50 & \text{ if } x\le -10\\ 100\left(3(0.05x+0.5)^2-2(0.05x+0.5)^3 - 0.5\right) & \text{ if } -10<x\le 10\\ 50 & \text{ if } x>10 \end{cases}$$

$\endgroup$ $\begingroup$

If necessary you could scale a sine function to make the transition:

$$ f(x) = \begin{cases} -50 & \quad x<-10\\ 50\sin(\pi x/20) & \quad -10 \le x \le 10 \\ 50 & \quad x >10 \end{cases}$$

$\endgroup$ $\begingroup$

There exist smooth complactly supported functions on $\mathbb{R}$, namely bump functions. Pick any such function and integrate it to obtain a monotonic smooth function $F$ that is zero for small enough values and is some non-zero constant for large enough values. Then you can obtain a graph like on the picture with an appropriate affine transformation. ($aF(bx+c)+d$ for some $a,b,c,d\in\mathbb{R}$)

$\endgroup$

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like