These exercises are not tied to a specific programming language. Example implementations are provided under the Code tab, but the Exercises can be implemented in whatever platform you wish to use (e.g., Excel, Python, MATLAB, etc.).
**Exercise 1: Sinusoidal signals and test functions**
1. Plot the sum of at least two sine functions with with differing frequencies and amplitudes. For now, don't include phase angles. Your sum will be the "signal" function, representing a hypothetical measurement in time of an oscillatory quantity. Plot over enough time that you can see many cycles but not so much that you can't make out the features of the signal.
Note that, in a spreadsheet, an approximation to $\pi$ can often be entered into formulas as ```PI()```.
1. Overlay a "test" function on your plot. The test function should be a sine function with arbitrary amplitude and with a frequency that you will vary. As a start, enter any frequency you'd like.
*Suggestion for spreadsheets:* Reference the test function's frequency to a cell so that you can change its frequency simply by changing the value in the cell.
**Exercise 2: A notion of correlation**
Vary the frequency of the test function and observe your plot.
1. Is there a noticeable difference between the cases when
- your test function has a frequency equal to one of the frequencies from the signal, or
- your test function does not have a frequency from the signal?
2. If you were given a signal function composed of sine functions with unknown frequencies, do you think you could determine its unknown frequencies visually by varying the frequency of a test function?
**Exercise 3: A better metric for correlation?**
At each value of time multiply your signal by your test function and plot the product as a function of time on a new axis. Again vary the frequency of the test function and observe your new plot.
1. Is there a noticeable difference between the cases when
- your test function has a frequency equal to one of the frequencies from the signal, or
- your test function does not have a frequency from the signal?
Pay particular attention to the maximum and minimum values of the plot of the product.
2. If you were given a signal function composed of sine functions with unknown frequencies, do you think you could determine its unknown frequencies by varying the frequency of a test function and looking at a plot of the product?
**Exercise 4: Amplify any asymmetry in the product**
1. Compute the *sum* of the product over all time values. Now vary the frequency of the test function and observe the *magnitude* of the sum.
Is there a noticeable difference between the cases when
- your test function has a frequency equal to one of the frequencies from the signal, or
- your test function does not have a frequency from the signal?
2. Explain the difference you've observed. Why is the magnitude of the sum noticeably different when the test function has a frequency close to the frequencies in the signal?
**Exercise 5: Frequency content in an unknown signal**
1. Use what you have learned or developed to extract frequency content from an unknown signal, which will be provided to you. This means you must discover what frequencies are significantly present in the signal, and your answer should be a list of the frequencies you find.
3. Create a plot of a sum of sine functions with the frequencies you have extracted from the signal, and compare it with the signal itself. Adjust the amplitudes of the different sine functions in your sum until your function resembles the signal. Then change the amplitude of the term with the smallest frequency to zero and observe how your sum of sine functions changes. Does it still resemble the signal?
**Exercise 6: Automate the frequency scan**
Rather than changing the frequency of the test function by hand,
1. create a range of test function frequencies,
2. compute the sum of the product of functions for each frequency, and
3. create a plot of the magnitude of the sum with the varying test frequencies.
What can you say about the peaks of this plot?
**Exercise 7: Phase**
Until now we have not considered phase. In general, however, oscillatory signals won't be well-approximated by sums of in-phase sine functions (sine functions all having zero or identical phase). To investigate the effect of differing phases, begin with your results from **Exercise 6** and use a new signal function for which each separate sine function in the sum has its own phase angle.
*Suggestion for spreadsheets:* Reference the different phases in your formula to different cells so that you can change the phase angles simply by changing the values in the cells.
1. When you vary the phases of the sine functions in your signal, how are the major peaks in your plot affected?
2. When your signal function is composed of sine functions with arbitrary phases, are you still able to extract or identify its frequencies?
**Exercise 8 (optional): Peak height**
Argue that the absolute heights of the peaks on your plot from **Exercise 6** are not physically relevant.