Lesson goal: For loops to plot sin and cos

Previous: Plot a star | Home | Next: Test the famous sin/cos identity

The sine and cos functions are wonderful functions to plot. They have three key parameters that are worth looking into: their amplitude, frequency, and phase. The amplitude is how tall the function are. The frequency is how fast they go up and down, and their phase is how far left or right they appear to be pushed. The general formula for a good sine function is $y=A\sin(2\pi f x+B)$, where $A$ is the amplitude, $f$ is the frequency, and $B$ is the phase. Let's plot some of these sine functions (or sin waves) here and see how they look. We'll use a for-loop to cycle through the free variable, $x$.

Make some plots here should help yo to understand the sine function and how the three parameters affect its behavior.

Now you try. Try fixing the A=, f= and B= statements.

Type your code here:

See your results here: