Formula of a modified Sinusoidal function

What is the formula of a function like this:

enter image description here

The highlighted part is like a $sin(x): -\pi/2 \leq x \leq \pi/2$. It's derivative at bounding points $(x_{min},y_{min})$ and $(x_{max},y_{max})$ should be zero. I have found $f(x)=\frac{y_{max} - y_{min}}{2} Sin(\frac{\pi}{x_{max}-x_{min}}x + \phi) +\frac{y_{max}+y_{min}}{2}$ but I don't know how to find the phase $\phi$.


Putting $(x_{max}+x_{min})/2$ (the horizontal translation) inside the argument of the function you will be able to find $\phi$:

$$f(x-\frac{x_{max}+x_{min}}{2})=\frac{y_{max}-y_{min}}{2}\sin(\frac{\pi}{x_{max}-x_{min}}(x-\frac{x_{max}+x_{min}}{2}))+\frac{y_{max}+y_{min}}{2}=$$

$$=\frac{y_{max}-y_{min}}{2}\sin(\frac{\pi}{x_{max}-x_{min}}x-\frac{\pi}{2}\frac{x_{max}+x_{min}}{x_{max}-x_{min}})+\frac{y_{max}+y_{min}}{2}$$

so $$\phi=-\frac{\pi}{2}\frac{x_{max}+x_{min}}{x_{max}-x_{min}}.$$

I hope there isn't any mistake.


Answer: $f(x)=\frac{y_{max} - y_{min}}{2} Sin(\frac{\pi}{x_{max}-x_{min}}(x - \frac{x_{max}+x_{min}}{2})) +\frac{y_{max}+y_{min}}{2}$

To find $\phi$, verify for $x = {x_{min}}$, whether $y = {y_{min}}$

or for $x = \frac{x_{min} + x_{max}}{2}$, $y = \frac{y_{min} + y_{max}}{2}$