0

I currently have a translated sine graph with the following formula:

$$\left(\sin\left(\frac{x}{50 / \pi} - \frac{\pi}{2}\right) + 1\right) \cdot 0.5$$

Which makes a graph like this

enter image description here

However I need to have the amplitude range between $0.2$ and $1.0$. Is there any way I can do this, while keeping the mentioned range as a variable, such as changing the min and max range at will?

orion
  • 15,781
TheGeekZn
  • 113
  • 7

1 Answers1

1

Very easy to construct, $\sin$ goes from $-1$ to $+1$ so you just shift and stretch: $$f(x)=\text{min}+\frac12(\text{max}-\text{min})(1+\sin (kx+\phi))$$ or, if you prefer $$f(x)=\text{average} + \text{amplitude}\cdot \sin (kx+\phi)$$ where average=(max+min)/2 and amplitude = (max-min)/2.

orion
  • 15,781
  • Sorry for the ignorance, I'm coming from a software development angle into a math world, I have no idea what (kx+ϕ) means, or what variables they translate to. – TheGeekZn Jul 23 '15 at 07:37
  • You already have that, I just used a generic expression for horizontal stretch and phase shift. In your case, $kx+\phi=\pi x/50-\pi/2$. I thought you'd pick that up by comparison to your expression. Use whatever symbols you like, it could have been ž for all we care... – orion Jul 23 '15 at 07:39
  • Unless I'm doing this wrong - using a max of 1 and a min of 0.2, the plotted graph from the first equation ranges from 0 to 1.2, instead of 0.2 to 1 – TheGeekZn Jul 23 '15 at 07:46
  • You probably forgot the $1+$ in the parentheses. You can see what I did... $\sin$ is in the interval $[-1,1]$. So first I add $+1$ to make it $[0,2]$. Then I cut it in half to squeeze it in the range $[0,1]$. Then I multiply with the span between max and min to make it just wide enough, $[0,max-min]$. Finally, I shift it up by $min$ to push it into range $[min,max]$ which is what you wanted. – orion Jul 23 '15 at 07:49