There are all sorts of resonances around us, in the world, in our culture, and in our technology. A tidal resonance causes the 55 foot tides in the Bay of Fundy. Mechanical and acoustical resonances and their control are at the center of practically every musical instrument that ever existed. Even our voices and speech are based on controlling the resonances in our throat and mouth. Technology is also a heavy user of resonance. All clocks, radios, televisions, and gps navigating systems use electronic resonators at their very core. Doctors use magnetic resonance imaging or MRI to sense the resonances in atomic nuclei to map the insides of their patients. In spite of the great diversity of resonators, they all share many common properties. In this blog, we will delve into their various aspects. It is hoped that this will serve both the students and professionals who would like to understand more about resonators. I hope all will enjoy the animations.

Origins of Newton's laws of motion

History of mechanical clocks with animations
Understanding a mechanical clock with animations
includes pendulum, balance wheel, and quartz clocks

## Wednesday, January 14, 2009

### The Spectrum of a Waveform - Fourier Analysis

M any modern technologies involve vibrations, oscillations, and waves.  These include:
• modern imaging
• in medicine
• by sonar
• vibration analysis and control (for airplanes, space craft, automobiles, etc).
• acoustics:
• consumer audio-electronics such as stereos
• architectural acoustics such as design of concert halls and auditoriums
• noise abatement in buildings and vehicles
• understanding of musical instruments
• understanding, protection of, and treatment of human and animal hearing and voice creation
In all of these, Fourier series and Fourier transforms serve as important mathematical tools.  They serve the function of breaking a waveform into its frequency components.  Fourier series and Fourier transforms are mathematically very similar and are referred to collectively as Fourier analysis.

### The prism

In 1670-1672, Sir Isaac Newton showed that running white light through a prism broke it into colors.  We now know that white light is composed of a range of frequencies of electromagnetic waves.  The different colors are merely different frequencies and these different frequencies of light travel at different velocities through most glass.  The result is that a glass prism will refract or bend the different frequencies into different angles and so separate them.  A prism physically does to the incoming light waves what Fourier analysis can do mathematically.  Today's electronics are not quite fast enough to record the oscillations of light directly and allow the frequencies to be separated with Fourier analysis.  On the other hand, the method of electronic sampling of waves and the application of Fourier analysis is currently used for many lower frequency phenomena, such as sound.

 The physics of the prism: glass is a dispersive media (meaning that different frequencies of light travel at different velocities). This dispersion results in light of various colors being refracted by different angles while traveling through the prism and thereby being separated out. Sir Isaac Newton was first to do extensive experiments using a prism to break up sunlight into its various colors.  He also showed that a subsequent prism could not further subdivide each individual color.  On the other hand, he found that a second prism could recombine all the colors back into white light.

 Four examples of optical spectra obtained using a prism. A continuous spectrum, similar to that of the sun or an incandescent  light bulb. A bright line spectrum such as emitted by a hot gas.  The mercury atoms inside a fluorescent light bulb (inside the phosphorus coating) emit such a spectrum. A dark line spectrum.  This is typical of a continuous spectrum after it passes through a cold gas that absorbs certain frequencies of the light.  Careful examination of the sun's spectrum revels such dark lines produced by the absorption of certain frequencies of light by the gases in the outer atmosphere of the sun.The sun's spectrum. The intensity of the light is plotted versus the wavenumber (which is proportional to the frequency of the light).  The graph shows the faint dark lines mentioned above. These lines can be used to identify the elements in the sun's outer atmosphere.

### Typical signals analyzed by Fourier analysis

Some typical acoustical and electronic signals that one encounters are shown below.  The job of Fourier analysis is to decompose these signals into pure sinusoidal frequency components, similar to what the prism does to optical waves. Mouse over each box to see the animation.  Click on them to restart.  The graphs are labeled as "pressure", in reference to the acoustical pressure of sound waves impinging a microphone.  Image (d) could be from normal speech while (e) is typical of the waveform from a musical instrument.  Alternately, the graphs could be plots of voltage versus time of the electronic signal coming from the microphone.  Plots (a), (b), and (c) are typical electronic signals occurring in computers and other electronics devices.  If our electronics where faster so that we could detect the extremely fast electromagnetic oscillations in white light, they would look similar to (d).

### Fourier transforms and Fourier series

 Joseph Fourier (1768-1830).  French mathematician and physicist.  He hypothesized that an abrupt transition of a waveform contains a range of frequencies and did the initial work on Fourier series.  He was working on the mathematics of heat flow.     He was born the son of a carpenter, orphaned at age 9.  He was very bright and gained entrance into top schools and later into important military jobs. Fourier found favor with Napoleon and was appointed governor of lower Egypt for a short time, until the British captured it. He later became the permanent secretary to the French Academy of Sciences.
Fourier series are used for repeating waveforms like the "square wave" shown below.  Repeating waveforms only contain frequencies at exact multiples of the fundamental repetition frequency.

 Fourier analysis breaks a waveform into its pure sinusoidal frequencies.  Here we see a square wave (like the kind used in telephone dialing tones) broken into the three lowest frequency components.  There are really an infinite number of components, although the higher frequency ones are of smaller and smaller amplitudes.  Another interesting fact about square waves is that they only have odd integer overtones, i.e. they have a fundamental frequency, an overtone at three times the fundamental frequency, one at five times, one at seven times and so on. A square wave is a repeating waveform, so a Fourier series analysis was used to break it into an infinite series of sinusoidal waveforms shown above.   Mouse over the animation to start it and off to suspend it.

### The spectrum - line spectrum

As in the case of a spectrum from a prism, we can plot the amplitudes of all the frequency components versus frequency of each component to produce a spectrum.  For the square wave illustrated above, we get the following bar graph shown below.  Each bar in this "line" spectrum represents the amplitude of one of the frequencies contained in the original square wave. As in the optical case discussed above, we call this type of spectrum where the components only exist at particular points along the frequency axis a line spectrum

One of the peculiarities of square waves is that they only contain odd integer multiples of the fundamental frequency.  For a square wave, each of the odd harmonics has an amplitude proportional to 1/n  where  n  is the component index.  The 1/n line is shown as a dotted blue line on the animation.  Note that the component index,  n,  equals 1 for the fundamental frequency  f1, n equals 2 for the 1st harmonic, f2 (which is absent), n equals 3 for the 2nd harmonic f3 (which is present), and so on.

The frequency of each component is given by  fn = n × f1, i.e. the higher frequency components are at integer multiples of the fundamental frequency. We call such a spectrum harmonic.  Stringed musical instruments and many woodwinds are nearly harmonic.  At the same time, many structures have non-harmonic spectra where the frequencies of the higher resonant modes are not simple multiples of the fundamental frequency.  An example of a non-harmonic instrument is a typical church bell.  If you listen, you can hear disharmonious clashing (i.e. beating) of the frequency components.  Only very special bells are harmonic.  The optical line spectrum shown above in the discussion of the prism is also an example of a non-harmonic spectrum.

 A spectrum is simply a graph of the amplitudes of the various frequencies plotted versus their frequencies. Here we see a spectrum generated for the square wave in the animation to the left.  Because there are only distinct frequencies in a repeating waveform, such as the square wave shown, the graph is a bar graph showing the amplitudes of these distinct frequencies. The one quantity that is missing in this spectrum is any information about the relative phases of the frequencies.  While many spectral graphs are missing this phase information, some do contain it.  Having the amplitude and phase of all the component frequencies gives complete information about all the frequency components.  Because of this, scientist and engineers usually do not draw the second or middle graph of the three shown to the left.   Instead they usually are interested in only the first and last graphs, i.e. the wavefunction and the spectrum. As above, mouse over the animation to start it and off to suspend it.

### Continuous spectrum

If we have a non-repetitive waveform, such as one that has some random nature or does not often reoccur, then the above picture changes a little. First off, we need to use a Fourier integral (also called a Fourier transform) instead of a Fourier series to do the Fourier analysis, to break the waveform into its frequencies. However when we do break it into its various frequencies, we find that there is a tight packed set of frequency components, instead of the distinct components in the above discussion. This is illustrated in the animation at the right. Mouse over it to start the animation.  Click on it to restart it.

The tangle of frequency components renders the second graph almost worthless (valuable only to someone really interested in the interference process occurring here). The really useful graphs are the last two in the animation. Because the bar graph (the third graph) implies that there are distinct, separated frequency components, scientists and engineers use the last form of graph that just shows the amplitude of the components as a function of frequency. We call this type of spectrum, where there are not distinct, separate frequencies, a continuous spectrum.

### Fourier frequency components

One aspect of Fourier analysis that may be confusing is that the sinusoidal components of a Fourier analysis are unchanging.  That is to say, each frequency component is assumed to be completely constant in frequency, constant in amplitude, and in phase.  Some people call these frequency components "Fourier frequency components".  They are different from a musical sound which may change in amplitude and/or frequency (tone) as time progresses.  The idea is that traditional Fourier analysis is usually done on a complete waveform, for the entire duration of the waveform of interest, and it produces all the frequency components of this complete waveform.

It is certainly unintuitive (and amazing) that a collection of completely constant sine waves, all going on forever, period after period, could add up to something like the pulse seen in the above animation.  How can the constant sine waves completely cancel out at all times except when the pulse occurs?  Adding sine waves is tricky.  It is at the core of  the interference phenomenon.  Depending on their relative phase, two sine waves can add up to a larger or a smaller sine wave, i.e. depending on whether we have constructive or destructive interference or something in between.  In the case of the pulse above, you can get a taste of this by studying the second graph with the tangle of waves in it.  Only at the start (when the pulse is present) do all the waves line up to give completely constructive interference.  At the other times, they have all sorts of relative phases and add up to zero.  The particular spectrum of waves that Fourier analysis produces for the pulse is specially designed to add up to exactly zero when the pulse is not present and to the proper pulse value during the pulse.  Even after understanding this phenomena for years, I still find it incredible that it should work so well.

### Fast Fourier transforms

There is a process that is somewhere between the two extremes of completely constant frequency components and components that are completely free to change with time. This is the computer tool called an FFT, or Fast Fourier Transform. An FFT is an optimized computational method of doing Fourier analysis on a computer, often with real-time data.  For example, as a song is playing, a FFT program might display the frequency components as they change with time in the song.  The trick here is that such a program slices up the waveform into windows.  A "window" might be a one second slice of the music or a 0.2 second slice, etc.  For each slice, the program will compute the digital Fourier transform of that slice or window of data.  It then displays the spectrum of each window.  Since each slice may have a different spectrum, the displayed spectrum often changes in time as the program progresses through all the slices of data.  A more sophisticated program may use overlapping windows or windows that fade in and out.  The process of applying windows to a data stream is called windowing and is quite a science in itself. Unfortunately for FFTs the choice of the window, input bit rate and density of output frequencies can significantly affect the resulting spectrum.  It can render spectra that are not only indicative of the waveform, but also of these FFT parameters.  The goal of proper use of FFTs is to yield spectra that are close approximations to that of a traditional Fourier analysis, i.e. of the actual spectrum.

### Why sine waves?

Question: Why do we want to break a signal into a series of perfect sine waves?  After all, there is a similar mathematical process called a wavelet transform for decomposing a waveform into a series of square waves, triangular waves, or almost any set of primitive waveforms.

1. Sine waves are sorted out by dispersive media:

One reason that Fourier analysis is used so much is that many physical processes are frequency dependent, and tend to sort out sine wave components, not triangular, square, or other types of wave components.  Above we discussed the prism as an example of a physical system that sorts out sine wave components.   Similarly, all dispersive media tend to sort out sine wave components.  These include water waves, communication waves in optical fibers, and microwaves in waveguides (as is used in radar systems).  A single frequency sine wave passing though a dispersive medium will remain as a single frequency sine wave, whereas a triangular or square wave will be distorted into a more complicated waveform by the medium.

2. Sine wave remain sine waves propagating through electrons and physical structures.  Simpler physics.

It is also true that many electronic components and circuit subassemblies will similarly distort any waveform that is not sinusoidal. This is not to say that a sine wave will not change in amplitude, phase, or some other property, but the wave will remain a sine wave.  Because a sine wave will remain a sine wave, scientists and engineers often decompose a waveform into its sinusoidal components, before analyzing the effect that a particular circuit or situation will have on a signal.  The physics with a single frequency sinusoid signal applied to a physical  structure is usually much simpler than the physics with a complex signal or with other types of primitive waveforms.  The attraction of sine waves is further enhanced by the efficiency by which complex math can deal with sine waves (and not with other waveforms).   I might note that all this works only if the system is linear; however, it turns out that many, many structures and processes are linear or nearly so.  I might also point out that in digital circuit design this is not true and pulse waveforms are the primary waveform of use, with sine waves providing a secondary role (which becomes more important at very high data rates.)

 Photo and diagram of a Helmholtz resonator. It is set into resonance by blowing over the neck.  It resonate in what is often called as a "breathing mode", involving air flowing in and out of the neck accompanied by an oscillating pressure inside the bulb (shown in the animation by the changing color inside the bulb). The resonance relies on the interplay of the momentum of air flow in the neck and the pressure in the bulb.  Mouse over the diagram to see the animation.  In a real Helmholtz resonator, the breathing occurs much, much faster than the animation shows.

3. Resonators oscillate sinusoidally.

Resonators are used throughout electronics as clocks and filters. Furthermore, most musical instruments are built around resonators. Resonators represent another area that finds particular utility for Fourier analysis.  Most resonators are linear or nearly linear.  When they oscillate, their oscillating parameters execute a nearly perfect sine wave. Consider an empty wine bottle as a typical acoustical resonator. When excited, by blowing over the neck, the pressure inside will execute a sine waveform. A tiny microphone put inside the bottom will detect this sine wave. In the 1850's Hermann von Helmholtz experimented with a carefully made set of Helmholtz resonators patterned after a wine bottle to explore pure musical notes, which he reasoned were pure sine waves.  One of his resonators is shown at the right.

4. Resonators respond selective to particular sine wave components.

We can also use the wine bottle to demonstrate how resonators respond selectively to particular sine wave components. To do this, place it in a room full of background noise containing a random mix of frequency components. The microphone inside the bottle will detect a near perfect sinusoidal signal of just one frequency, a frequency equal to the resonant frequency of the bottle.  The wine bottle is selectively responding to one specific sine component of the background noise. Most musical instruments are not as simple as a wine bottle and have many resonances. At the same time, they usually behave as a collection of simple resonators, resonating at each of their multiple resonances, all of which respond with simple sinusoidal waveforms.  Other mechanical and electronic resonant systems also usually behave as a collection of simple sinusoidal resonators.

### Exactly what do I mean by a sine wave in the above discussion?

Above I am being fairly loose with the term "wave" when applied to a "sine wave".  I am guilty of intermixing the term "wave" with "waveform".  In this posting I am referring to any physical parameter or any signal that when plotted versus time or versus distance has the shape of a sine (or cosine) function.  It may be a true wave, such as a water wave, propagating through some medium, or it may simply be an oscillating parameter, such as the pressure inside a wine bottle.  This is consistent with the usage by most electrical engineers and physicists.  When they need to distinguish between true propagating waves and oscillations, they will; however, in cases such as with Fourier transforms, where the math is similar in either case, they will refer to anything with a sinusoidal shape on a graph as a "sine wave".
 Copyright 2009, P. Ceperley / Permitted uses of this material LAST POSTING: Water waves derivation 2 - dynamics of the free surface NEXT POSTING: Mathematical definition of Fourier series