# I need a differentiable function whose plot is a plateau and the steepness and width can be varied arbitrarily and easily

I need to model the solar radiation incident on a solar panel. I tried using $$\tanh(b*(x-a))-\tanh(b*x)$$ but it does not give me a lot of flexibility with the characteristics of the curve, namely width of the plateau and its steepness.

-

When you want a graph that looks like a smoothed version of the characteristic function of the interval $[0,a]$ then your "Ansatz" is just perfect. Increasing $b\gg1$ controls the steepness of the vertical sides. But if you want to model the radiation intensity during a day, or a year, you have to talk about the inclination angle of the rays, etc.

-

I would suggest taking a normal distribution and inserting a constant value for the length of your plateau. This is the normal distribution, multiplied by a constant factor: $$f(\sigma, \mu ,h, x) = h\cdot \frac{1}{\sigma\sqrt{2\pi}} e^{ -\frac{(x-4)^2}{2\sigma^2} }$$ Now lets define $$p(\sigma,\mu,h,x) = \begin{cases} f(\sigma,\mu,h,x) \quad \text{if }x<-\mu \\ \frac{h}{\sigma \sqrt{2\pi}} \quad \text{if }-\mu\leq x \leq \mu \\ f(\sigma,\mu,h,x) \quad \text{if }x<-\mu \\ \end{cases}$$

This function is continous on $\mathbb{R}$ and can easily be scaled. For different width you can modify $\mu$, and the height can be modified by $h$ and $\sigma$. The steepness can be varied by $\sigma$.

-

$$\frac{1}{(e^{b(x-a)}+1)(e^{b(-x-a)}+1)}$$

The width of the plateau is $2a$, and the steepness increases with $b$. Note that one exponential controls each side, so you can modify each one independently if you like. Note that this is never exactly $0$ outside the plateau or exactly $1$ inside it.

-