# 8.2.3: Fourier Series Simulation

- Page ID
- 26217

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

\( \newcommand{\Span}{\mathrm{span}}\)

\( \newcommand{\id}{\mathrm{id}}\)

\( \newcommand{\Span}{\mathrm{span}}\)

\( \newcommand{\kernel}{\mathrm{null}\,}\)

\( \newcommand{\range}{\mathrm{range}\,}\)

\( \newcommand{\RealPart}{\mathrm{Re}}\)

\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

\( \newcommand{\Argument}{\mathrm{Arg}}\)

\( \newcommand{\norm}[1]{\| #1 \|}\)

\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)

\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)

\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vectorC}[1]{\textbf{#1}} \)

\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)This simulation shows the sum of up to eight harmonics (five on mobile devices) of a sine wave. Initially the speed is set to zero to make the visualization simpler. A ** harmonic **of a sine wave is a sine wave that has a frequency which is a whole number multiple of the frequency of the original wave. The first harmonic (set with the slider \(A1\)) is called the

**. So if the fundamental is \(f_{1} = 200\text{ Hz}\) the second harmonic is \(f_{2} = 400\text{ Hz}\), the third harmonic is \(f_{3} = 600\text{ Hz}\), etc. We know \(v=\lambda f\) so for a fixed speed, doubling the frequency means the wavelength of the second harmonic is half that of the fundamental. Conversely, holding your finger down in the middle of a guitar string and plucking one side cuts the wavelength in half which doubles the frequency being played. For standing waves on a string fixed at each end (such as a guitar string) each harmonic is also called a**

*fundamental*

**normal mode****of vibration.**

The graph on the upper right in the simulation is the Fourier spectrum and is a short hand way of showing how much of each harmonic is present in the graph on the left. Fourier series usually include sine and cosine functions and can represent periodic functions in time or space or both. In this simulation we only have combinations of sine waves. The Fourier series for the wave function showing in the left graph is given by \(y(t)=\sum_{n=1} A_{n}\sin (n2\pi x/\lambda-n2\pi f_{1}t)\). Here \(t\) is time, \(n\) is the number of the harmonic or mode (\(n=1\) for the fundamental, \(2\) for the second harmonic etc.), \(A_{n}\) is the amplitude of harmonic or mode number \(n\) and \(f_{1}\) is the fundamental frequency (\(f=1/T\)). Amplitude is in arbitrary units, scaled between \(1\) and \(-1\).

Note

The Fourier Series and Sound JavaScript Model uses the HTML 5 Web Audio API. This API is still under development and may not be supported on all platforms. Press the Reset button to reinitialize the simulation if the sound does not play when the simulations is first loaded.

## Simulation Questions:

- Try adjusting the slider A
_{1}to different values. What does this slider do? If you have speakers, turn the sound on and listen. This is a \(200\text{ Hz}\) sine wave. - You may have noticed the amplitude shows up in the graph on the right. You can also see the magnitude of the amplitude by holding the mouse the mouse button down and moving the mouse to the top of one of the peaks on the graph on the left. Does it match the value of \(A1\) set by the slider? Use the mouse to find the wavelength (distance between peaks on the left graph), what is the wavelength of this wave?
- Use the 'reset' button and move slider \(A_{2}\) (the second harmonic). What is the wavelength of the second harmonic? How does this wavelength compare to the wavelength of the fundamental? This is a \(400\text{ Hz}\) sine wave. What does it sound like?
- The pitch of a sound wave is determined by the fundamental frequency. Turn on the velocity (\(344\text{ m/s}\) for sound at room temperature) by clicking the simulation run button. With only amplitude A
_{1}showing, run the simulation. Find the period by measuring the time (in \(10^{-3}\text{ sec}\)) between when one peak passes the origin and when the next peak passes (use the step button to get an accurate time measurement). What is the frequency of the fundamental? - Now find the period of a wave with several harmonics. What is the period of the combination (the time between successive highest peaks)? Although the wave looks more complicated it has the same fundamental frequency and therefore the same pitch. The additional, smaller peaks are due to the harmonics and give a sound its
*timbre*. A trumpet and trombone playing the same note have the same fundamental frequency but sound different because of the number and amount of harmonics present. - To get the exact shape of an arbitrary periodic function we would need an infinite number of terms in the Fourier series but in this simulation we can only add a maximum of 8 terms. Try the following combination of harmonics (you can type the amplitudes into the boxes next the sliders to get exact values): \(A_{1} = 1.0,\: A_{2} = 0,\: A_{3} = 0.333 (= 1/3),\: A_{4} = 0,\: A_{5} = 0.20 (= 1/5),\: A_{6} = 0,\: A_{7} = 0.143 (= 1/7),\: A_{8} = 0\). What is the approximate shape of this wave? If you have speakers, turn the sound on and listen.
- Reset the simulation and try the following combination of harmonics (you can type the amplitudes into the boxes next the sliders to get exact values): \(A_{1} = 1.0,\: A_{2} = -0.5,\: A_{3} = 0.333,\: A_{4} = -0.25,\: A_{5} = 0.20,\: A_{6} = -0.166,\: A_{7} = 0.143,\: A_{8} = -0.125\). What is the approximate shape of this wave? If you have speakers, turn the sound on and listen.
- Suppose a clarinet and a trumpet both play the same note (have the same fundamental frequency). Why is it that you can still tell them apart, even though they are playing the same note?
- Find a definition of timbre and write it in your own words. Based on your answers to the above questions, what causes timbre?
- Suppose you wanted to build an electronic instrument which added waves together to imitate other instruments (this is how some musical synthesizers work). What would you need to know about the sound a trumpet makes in order to reconstruct that sound? (Hint: think about the information contained in the graph at the top right.)