[Table of Contents] [Previous section] [Next section]

Harmonic analysis and the Fourier Transform

Some signals exhibit periodic components that repeat at fixed intervals throughout the signal, like a sine wave. It is often useful to describe the amplitude and frequency of such periodic components exactly. Actually, it is possible to analyze any arbitrary set of data into periodic components, whether or not the data appear periodic. Harmonic analysis is conventionally based on the Fourier transform, which is a way of expressing a signal as a sum of sine and cosine waves. It can be shown that any arbitrary discretely sampled signal can be described completely by the sum of a finite number of sine and cosine components whose frequencies are 0,1,2,3 ... n/2 times the fundamental frequency f=1/nx, where x is the interval between adjacent x-axis values and n is the total number of points. The Fourier transform is simply the coefficients of these sine and cosine components.

The concept of the Fourier transform is involved in two very important instrumental methods in chemistry. In Fourier transform infrared spectroscopy (FTIR), the Fourier transform of the spectrum is measured directly by the instrument, as the interferogram formed by plotting the detector signal vs mirror displacement in a scanning Michaelson interferometer. In Fourier transform nuclear magnetic Resonance spectroscopy (FTNMR), excitation of the sample by an intense, short pulse of radio frequency energy produces a free induction decay signal that is the Fourier transform of the resonance spectrum. In both cases the spectrum is recovered by inverse Fourier transformation of the measured signal.

The power spectrum is a simple way of showing the total amplitude at each of these frequencies; it is calculated as the square root of the sum of the squares of the coefficients of the sine and cosine components.

Figure 10. The signal on the left (x = time; y = voltage), which was expected to contain a single peak, is clearly very noisy. The power spectrum of this signal (x-axis = frequency in Hz) shows a strong component at 60 Hz, suggesting that much of the noise is caused by stray pick-up from the 60 Hz power line. The smaller peak at 120 Hz (the second harmonic of 60 Hz) probably comes from the same source.

A signal with n points gives a power spectrum with only (n/2)+1 points. The x-axis is the harmonic number. The first point (x=0) is the zero-frequency (constant) component. The second point (x=1) corresponds to the fundamental frequency, the next point (x=2) to twice the fundamental frequency, the next point (x=3) to three times the fundamental frequency, etc. An example of a practical application of the use of the power spectrum as a diagnostic tool is shown in Figure 10.

In the example shown here, the signal is a time-series signal with time as the independent variable. More generally, it is also possible to compute the Fourier transform and power spectrum of any signal, such as an optical spectrum, where the independent variable might be wavelength or wavenumber, or an electrochemical signal, where the independent variable might be volts. In such cases the units of the x-axis of the power spectrum are simply the reciprocal of the units of the x-axis of the original signal (e.g. nm-1 for a signal whose x-axis is in nm).


SPECTRUM, the freeware signal-processing application that accompanies this tutorial, includes a power spectrum function, as well as forward and reverse Fourier transformation.
Matlab has built-in functions for computing the Fourier transform (FFT and IFFT). The power spectrum of a signal vector "s" can be computed as real(sqrt(FFT(s) .* conj(FFT(s)))).

Interactive Power Spectrum Demo for Matlab


Click to view enlarged figure


Click to view enlarged figure
Digital signal generator (simulator) for Matlab, with power spectrum display, sliders for real time control, and audio waveform output. Requires Matlab 6.5. This program is useful for teaching and demonstrating the power spectra of different types of signals and the effect of signal duration and sampling rate.
  • The Signal slider selects from 10 different pre-programmed signals*. (You can change the signal definitions in RedrawSpectrum.m).
  • The Time slider controls the total duration of signal (seconds).
  • The Rate slider controls the sample rate (Hz).
  • The F1 and F2 sliders control the global variables f1 and f2 which are used to control the frequency, phase, time, and/or amplitude of the different pre-programmed signals as described below.
  • The Sound slider has only two settings: OFF (down) and ON (up). When Sound is ON, each time a slider is moved, the signal (in the variable "y") is sent to the Windows WAVE audio device. When Sound is OFF, no sound is played when a slider is moved. However, even when Sound is OFF, clicking on the Sound slider plays the signal once for each click.

    Click here to download the ZIP file "PowerSpectrumDemo11.zip", which also includes supporting functions and self-contained demos to show how it works. You can also download it from the Matlab File Exchange.

    * The 10 pre-programmed signals are: Sine wave of frequency f1 (Hz) and phase f2; Sine wave burst of frequency f1 (Hz) and duration f2; Square wave of frequency f1 (Hz) and phase f2; Sawtooth wave of frequency f1(Hz); 440 Hz carrier amplitude modulated by sine wave of frequency f1 (Hz) and amplitude f2; 440 Hz carrier frequency modulated by sine wave of frequency f1 (Hz) and amplitude f2; Sine wave of frequency f1 (Hz) modulated by Gaussian pulse of width f2; Random white noise; Sine wave of frequency f1 (Hz) and amplitude f2 plus random white noise; Sine wave sweep from 0 to f1 (Hz).

    T. C. O'Haver (toh@umd.edu), version 1.1, May, 2007


  • [Table of Contents] [Previous section] [Next section]
    Last updated April, 2008. This page is maintained by Prof. Tom O'Haver , Department of Chemistry and Biochemistry, The University of Maryland at College Park. Comments, suggestions and questions should be directed to Prof. O'Haver at toh@umd.edu.