This is a brief and simple [1] explanation of how to adjust the standard sinusoid to change its amplitude, frequency and phase shift. More precisely, given the general function:
We’ll see how adjusting the parameters , and affect the shape of . Each section below covers one of these aspects mathematically, and you can use the demo at the bottom to experiment with the topic visually.
Scaling
Scaling is conceptually the simplest change; we adjust to increase or decrease the amplitude (maximal height) of . Setting will make the value twice as large (in both the positive and negative direction) as the original function.
Stretching
Stretching changes the frequency of , which is inverse proportional to its period. The baseline function has a period of , meaning it repeats every . In other words, for any .
If we set , we get . This function repeats itself twice as fast as , because is multiplied by 2 before being fed into the sinusoid. If changes by , the sinusoid’s input changes by . Therefore, the period of is , the period of is and so on. [2]
More generally, the period of is . Play with the demo below to see this in action, by changing and observing how the waveform changes.
If we know the period we want, we can easily calculate the that gives us this period:
Shifting
The final parameter we discuss is ; it’s called the phase of the sinusoid. In the baseline , . The sinusoid is 0 at , achieves its positive peak at , crosses 0 again at , negative peak at and returns to its original position at where the repetition begins.
By adding a non-zero , we don’t affect the sinusoid’s amplitude or frequency, but we do shift it right or left along the axis. For example, suppose we use the function with . Then when , we have , so the sinusoid is already at its positive peak; at , the sinusoid crosses 0 into the negatives, etc. Everything happens earlier (by exactly the value of ) than in the baseline sinusoid. In other words, we’ve shifted the function left by . Similarly, when is negative, everything happens later, and the function is shifted right.
Putting it all together
We’ve now gone over all the parameters for the function:
- controls the scaling factor (amplitude).
- is the frequency and controls the repetition period
- controls the phase - how much the sinusoid is shifted left or right
Use the demo below to adjust these parameters and observe their effect on the sinusoid:
| [1] | The math level of this post is high-school, at best. My main goal here is to test how to integrate interactive demos into my blog posts. |
| [2] | This can be a bit counter-intuitive at first; we scale by 2, but the period scales by half. Why? The reason is that affects the sinusoid’s domain, while the period is a property of its range. Therefore, an inverse relation is reasonable, once we put more thought into it. In fact, is often called the angular frequency of the sinusoid, and frequency is inverse proportional to the period. |