I have a condtion as $$T(x)= \begin{cases} -1 & \text{if }x <a \\ 0 & \text{if }a\le x \le b \\ 1 & \text{if }x >b \end{cases} $$
I want to approximate the above condition as one formula using $tanh$ function . Could you help me please. This is my formula that I try
$T(x)=tanh(x-a).tanh(x-b)$
$$T(x)=\frac{tanh(x-a)+tanh(x-b)}{2} $$
With $T(x)=\frac{tanh(p (x-a))+tanh(p (x-b))}{2} $ you can approximate your function as well as you want by making $p\rightarrow \infty $