teaching fft principles in the physical chemistry...

5
Teaching FFT Principles in the physical Chemistry Laboratory Colin Steel and Thomas Joy Brandeis University, Waltham. MA 02254 Tom Clune Eye Research Institute. Boston. MA 02114 Instruments and methods based on FFT (fast Fourier transform) principles are becoming increasingly common in chemistry, and there have been several expositions on vari- ous aspects of the subject (1-9). Nevertheless, because of the expense and complexity of commercial apparatus, few stu- dents have an opportunity to get hands-on experience with an instrument. The result is that FFT concepts tend to remain an abstrac- tion not easily grasped and certainly readily forgotten. In an attempt to remedy this situation, we have developed an experiment, based on the classic determination of the veloci- tv of sound (v.) in a aas, which uses simple and readily available equipment tnbxemp~if~ some of the key concepts. In the usual version of the experiment 110, IJ), Kundt's tube, S is a speaker driven by a fixed frequency source (Fig. 1). The other end of the tube consists of a piston (P) that may be moved in or out until the resonance condition is met. Now, however, suppose that rather than a fixed-frequency sound source, we used one that simultaneollsly transmits a wide range of frequencies. By analogy to light, such a source may be regarded as a polychromatic or "white" source. Fur- ther suppose that the tube length is now fixed rather than variable. Then only certain wavelengths in the polychromat- ic source will be in resonance; other wavelengths will de- structively interfere. If a small microphone is placed a t P to detect the pressure fluctuations caused by the sound waves, then, as will be seen below, the time record of the pressure variations contains the information necessary to extract the resonance frequencies. The best known and most widely used method of transposing time domain data into the fre- quency domain is a process called Fourier transformation. General Principles Although the propagation of sound waves and Fourier transformation are covered in many texts, a student's first incursion. esoeciallv into the latter area, can be formidable. In this se&ioi we summarize the salient theoretical features and hooe to show that the underlving conceDts for obtaining a discrete Fourier transform are i n fact quite simple. AK though perhaps mathematically less elegant, the reader will note that we make no recourse to imaginary notation. Standing Waves in a Tube Consider a long tube of length L closed at both ends and filled with a gas (Fig. 1). Sound waves traveling down the tube are reflected at the ends, and, if the wavelength (X) of the waves is such that with n = 1. 2. 3.. . . . standine waves are established such .. . that the ends are pressure antkodes (an). These antinodes are reeions of maximum uressure oscillation (12). For n = 1 there rs one pressure node (n) at the center of the tube at Ll2, while for n = 2 there are two nodes at L/4 and 3L14, and so Figure 1. Sanding waves in a Nbe of length 1. The ends are regions of maximum pressure variation (antinodes). . on. In the usual version of the Kundt's tube experiment, L is adjusted until eq 1 is satisfied, the distance between nodes or antinodes, d.d,, is then measured yielding X (= 2. d.d and then v, from u.=u.x (2) where u is the frequency. In our version of the experiment S is now a "polychromatic" source and L is fixed. Only those source frequencies that satisfy both eqs 1 and 2 are in reso- nance, so that % v,&) = -. n with n = 1.2, . .. 2L (3) With the aid of FFT the values of the resonance frequencies, u,,(n), are determined. A plot of u,,(n) versus n then yields u&L and thus v. Fourier Transformation (a) The Fourier Series. It is well known (I, 13) that, sub- ject to a few conditions known as the Dirichlet criteria, a periodic function or signal, S(t), can he represented by a Fourier series The period (27 of the signal equals l l q , the reciprocal of the fundamental freouencv. The other s~ectral components (or . . lines) of the signal are overtones occurring with spacing 4" = v, at va = k . ul (k = 2.3.. . .).The Fourier coefficients (a'. bbJ . . . , . . . assocked wkh the kpkctral lines are the amplitudes of the various cosine and sine components. The coefficient anis the coefficient associated withihe zero-frequency (dc) compo- nent. Volume 67 Number 10 October 1990 883

Upload: nguyenduong

Post on 13-Apr-2018

224 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Teaching FFT principles in the physical chemistry laboratoryagust/kennsla/ee09/vee09/JCE1990p0883_FFT.pdf · Teaching FFT Principles in the physical Chemistry Laboratory ... tube

Teaching FFT Principles in the physical Chemistry Laboratory

Colin Steel and Thomas Joy Brandeis University, Waltham. MA 02254

Tom Clune Eye Research Institute. Boston. MA 02114

Instruments and methods based on FFT (fast Fourier transform) principles are becoming increasingly common in chemistry, and there have been several expositions on vari- ous aspects of the subject (1-9). Nevertheless, because of the expense and complexity of commercial apparatus, few stu- dents have an opportunity to get hands-on experience with an instrument.

The result is that FFT concepts tend to remain an abstrac- tion not easily grasped and certainly readily forgotten. In an attempt to remedy this situation, we have developed an experiment, based on the classic determination of the veloci- tv of sound (v.) in a aas, which uses simple and readily available equipment tnbxemp~i f~ some of the key concepts.

In the usual version of the experiment 110, I J ) , Kundt's tube, S is a speaker driven by a fixed frequency source (Fig. 1). The other end of the tube consists of a piston (P) that may be moved in or out until the resonance condition is met. Now, however, suppose that rather than a fixed-frequency sound source, we used one that simultaneollsly transmits a wide range of frequencies. By analogy to light, such a source may be regarded as a polychromatic or "white" source. Fur- ther suppose that the tube length is now fixed rather than variable. Then only certain wavelengths in the polychromat- ic source will be in resonance; other wavelengths will de- structively interfere. If a small microphone is placed a t P to detect the pressure fluctuations caused by the sound waves, then, as will be seen below, the time record of the pressure variations contains the information necessary to extract the resonance frequencies. The best known and most widely used method of transposing time domain data into the fre- quency domain is a process called Fourier transformation.

General Principles Although the propagation of sound waves and Fourier

transformation are covered in many texts, a student's first incursion. esoeciallv into the latter area, can be formidable. In this se&ioi we summarize the salient theoretical features and hooe to show that the underlving conceDts for obtaining a discrete Fourier transform are i n fact quite simple. AK though perhaps mathematically less elegant, the reader will note that we make no recourse to imaginary notation.

Standing Waves in a Tube Consider a long tube of length L closed a t both ends and

filled with a gas (Fig. 1). Sound waves traveling down the tube are reflected a t the ends, and, if the wavelength (X) of the waves is such that

with n = 1. 2. 3.. . . . standine waves are established such . . . that the ends are pressure antkodes (an). These antinodes are reeions of maximum uressure oscillation (12). For n = 1 there rs one pressure node (n) at the center of the tube a t Ll2, while for n = 2 there are two nodes at L/4 and 3L14, and so

Figure 1. Sanding waves in a Nbe of length 1. The ends are regions of maximum pressure variation (antinodes). .

on. In the usual version of the Kundt's tube experiment, L is adjusted until eq 1 is satisfied, the distance between nodes or antinodes, d.d,, is then measured yielding X (= 2. d . d and then v, from

u . = u . x (2)

where u is the frequency. In our version of the experiment S is now a "polychromatic" source and L is fixed. Only those source frequencies that satisfy both eqs 1 and 2 are in reso- nance, so that

% v,&) = -. n with n = 1.2, . . . 2L (3)

With the aid of FFT the values of the resonance frequencies, u,,(n), are determined. A plot of u,,(n) versus n then yields u&L and thus v..

Fourier Transformation (a) The Fourier Series. I t is well known (I, 13) that, sub-

ject to a few conditions known as the Dirichlet criteria, a periodic function or signal, S(t), can he represented by a Fourier series

The period (27 of the signal equals l l q , the reciprocal of the fundamental freouencv. The other s~ec t ra l components (or . . lines) of the signal are overtones occurring with spacing 4" = v , at va = k . ul (k = 2.3.. . .).The Fourier coefficients (a'. bbJ . . . , . . . assocked wkh the kpkctral lines are the amplitudes of the various cosine and sine components. The coefficient an is the coefficient associated withihe zero-frequency (dc) compo- nent.

Volume 67 Number 10 October 1990 883

Page 2: Teaching FFT principles in the physical chemistry laboratoryagust/kennsla/ee09/vee09/JCE1990p0883_FFT.pdf · Teaching FFT Principles in the physical Chemistry Laboratory ... tube

Since sin (01 + 82) = sin 81. cos 82 + cos 81 -sin 82, eq 4 can he rewritten more compactly as

S ( t ) = a, + A, . sin ( 2 r k q t + 6,) (5) ,=I

where 6k is a phase angle such that

a, = A,. sin 6, ( 6 )

and

bk = A k . ~086 , (7)

with Ak = m. By virtue of orthogonality relationships Fourier coefficients can he ohtained from

and

Knowing ak and bk and using eqs 6 and 7, Aa and 6a can then he ohtained, permitting representation of the original time- dependent signal in the frequency domain. Figures 2a and h show schematically such a transformation for a repetitive signal with period T. The first spectral line occilrs a t fre- quency 11T and the others with spacing 11T. Notice that the spectral lines continue indefinitely.

(h) Discrete Fourier Analysis (I, 2). We now examine the more realistic situation in which discrete data from a nonre- petitive signal is gathered during a finite time interval. When a signal is sampled a t time intervals At using an analogue-to-digital (AD) converter, afinite number of sam- ples (N) is taken during a finite record time (TR) with TR = N . At, Figure 2c. Although in reality we do not know what happens to the signal before or after this observation time, the Fourier transform procedure implicitly assumes that the signal is periodic with period TR. As we have seen from Figures 2a and h, this implied periodic time will control not only the lowest frequency u l = ~ / T R but also the spacing, Av = l l T ~ , hetween the discrete frequencies corresponding to the spectral lines. The sampling frequency uWp, equal to the reciprocal of the time between data samples (At), controls the highest frequency component (u,..) in the Fourier se- ries, Figure 2d. This can he seen as follows. If N equally spaced data samples are gathered in the time domain, then NI2 frequencies with equal spacing Au are generated in the frequency domain. Only half as many spectral lines are gen- erated as there are time samples hecause each frequency actually contains two hits of data-amplitude and phase.

Time Domain Frequency Domain f0) I Spcclral line

Flgure 2. Schematic representation of Fourier franstormation of signals from the time to frequency domain.

Thus u,, = Nl2. Av = (N12). (11T~) = ~ / Z Y - ~ . This maximum frequency is often called the Nyquist frequency ( U N ~ = u,.,).

In Figure 2a we have a continuous signal that corresponds to a sampling interval (At) of zero. Thus v,,,, (and hence urn,) are infinite so that the spectral lines of the Fourier transform (FT) in Figure 2b continue indefinitely. Sampling of a continuous signal, as is shown in Figure 2c, yields a discrete Fourier transform (DFT), Figure 2d, which is an approximation to the Fourier transform of the continuous signal in that the DFT cannot yield spectral lines ahove % b " p

We still have to cast eqs 8 and 9 in forms suitable for digital analysis. Replacing t hy n . At, v l by 11N. At(= ~ / T R ) and d t lT by AtlN. At we obtain

N-I

ak = 2 l N 1 S(n) cos (ZrknlN) (10) n=o

and N-l

b,, = 2 / N . 2 S(n) sin (2 rkn lM (11) n=o

where S(n) are the signals ohtained a t times t(n) = n . At. These equations allow numerical determination of the ak and bk coefficients. Equations 6 and 7 can then he used to obtain the amplitudes (Ah) and phases (6k) associated with the various uk = k l T ~ for k = 1,2, . . . , Nl2.

The fast Fourier transform (FFT) is simply a procedure for carrying out a DFT efficiently. Most FFT's require N time samples where Nequals 2 raised to some integral pow- er, e.g., 512 or 1024. In our case we used a modifiedversion of the program described in ref 1.

(c) Aliasing and the Nyquist Theorem. Clearly if we wish to include all the frequencies contained in our signal, the maximum signal frequency (u.,~,,) should he less than or equal to the highest frequency we can get from the FFT, i.e., YNQ. In fact Nyquist's theorem (I, 2,6 ) states that the sam- pling frequency should he a t least twice the highest frequen- cy in the signal to he analyzed. However, suppose that we are not careful enough and that our signal source contains fre- quencies q , vz, UQ, and u4, one of which (ug) lies ahove UNQ, Figure 3. Then, when the FFT is carried out, an alias fre- quency is generated a t u4 as if va had been reflected ahout a line a t UNQ; in general u, + u, = 2 . u ~ g = US,,. A simple example of aliasing is when we have a single frequency and sample a t exactly this frequency, then, as can he seen from Figure 4, sampling would lead us to conclude erroneously that we have a dc signal. Thus, if our source contains fre- quencies that lie ahove 'lzu,.,,, we should take care to insert a filter, commonlv called an anti-alias filter, to remove fre-

Figure 3. How a frequency v, greater man Uw Nyquist frequency (u,, = urn,/ 2) gemrmtes an alias at u,.

884 Journal of Chemical Education

Page 3: Teaching FFT principles in the physical chemistry laboratoryagust/kennsla/ee09/vee09/JCE1990p0883_FFT.pdf · Teaching FFT Principles in the physical Chemistry Laboratory ... tube
Page 4: Teaching FFT principles in the physical chemistry laboratoryagust/kennsla/ee09/vee09/JCE1990p0883_FFT.pdf · Teaching FFT Principles in the physical Chemistry Laboratory ... tube

0 500 1000 1500 2000 FREQUENCY (Hz)

Figure 8. The result of averaging a specrmrn likethat in Figure 7 10 times. me peak labeled 1 is the fundameml. 2 is the first ovenone, and so on. Peak 11 OCCUR above the Nyquist limit and shows up as the alias labeled 1 la.

while the very beneficial effect of carrying out 10 iterations and averaging is displayed in Figure 8. Notice that we have chosen t o display the results as a power, rather than ampli- tude, spectrum where power(u) is proportional to amp(^)^. This is a common practice in FFT experimentation to make neaks stand out somewhat more s h a r ~ l v from the back- . . ground and small unwanted peaks. For example, an alias peak that is 10% of a real peak on an amplitude scale is onlv i% of the real peak on apower scale. AISO notice that fie- auencies not in resonance do-indeed destructively interfere and so have negligible power components.

Since our filter did not fall off sufficiently sharply above Y ~ Q , an alias peak (indicated l l a ) can be seen. If the experi- ment is repeated without the filter, alias peaks become more orominent and so can he readilv distineuished. If the alias peaks fall too close to the true risonanc&, they can be shift- ed by varying the sampling frequency which changes V N Q . A spectrum of the noise source can be obtained by sampling the sneaker outout in the absence of the resonance tube. This i s shown in Figure 9, where i t will be seen that some freauencies above 2 kHz do get past the filter accounting for thek ias peak l la in ~ i g u r e 8 . -

-

The values of the resonance maxima are easily determined by examining a tabular output of the data displayed in Fig- ure 8. A plot of the resonance maxima versus n yields a straight line with slope 187.4 * 0.4 s-'. Using this value and L = 916.9 mm, gives u, = 343.6 f 0.7 mls (see eq 3), which compares very favorably with the accepted value (345.0 mls) for the speed of sound in dry air a t 296 K. Six setsof indepen- dent experiments taken over a period of weeks gave u, = 343.3 f 1.1 mls; theslightly larger error probably reflects the fact that in each experiment a new value of L was used. Indeed the technique is sufficiently precise so that the small difference in the velocity of sound in such similar gases as nitrogen (347.8 mls) and oxygen (328.9 mls) can he mea- sured, so that the traditional experiment of measuring heat capacity ratios y (u. = (RT,IM)' 2 j of different gases can be carried out with excellent accuracy.

More significantly, through the experiment the student learns about important characteristics of FFT; these in- clude:

(1) Primary data in the rimedomain (Fig. GI may look hopelessly eomplen. but nevenhelrrs they yield simplr interpretabledata whrn [ransferred rnttr the frequency domain (Figs. 7 and 8).

(2) The experiment can he performed by using a frequency gener- ator to scan through the frequencies sequentially and observing the amplitude of the signals on an oscilloscope. This corresponds to the usual wav of taking a soectrum. However, a FFT spectrometer is inherentiy more efficiedt than a conventiok4 scanning instrument

[r

s 0 a

with onti-olios filter

0 1000 2000 3000 4000 5000 FREQUENCY (Hz)

Figure 9. Power spectrum of the source in the absence and presence of the anti-alias filter. Notice that freqvencies above 2 kHz are still present account- ing for the alias peak in Figure 8.

because the sample is irradiated with all frequencies simultaneous- ly. This allows a FFT spectrum to be recorded in a shorter time than a conventional spectrum-an advantage commonly referred to as the Fellgett advantage (3, 6). Because of rapid data acquisition, averaging over many runs becomes quite feasible, especially since the data are gathered digitally and are already in the computer. The resulting improvement in signal-to-noise ratio often results in en- hanced sensitivity. The 512 data points in Figure 7 were gathered in 128 ms. Carrying out the actual Fourier transformation may be slower. In our case, using a simple IBM/PC equipped with a math coprocessor chip and using a compiled Basic program, an individual FFT took 14 s.

(3) In a conventional suectrometer excitatioh radiation is eener- . . - allvaelected hv instrumental elements such as slitrand a monoehro- , ~~ ~~~~ ~, ~ ~ ~ ~~ ~ ~~~~ -~~~

mator rhnt limit the enrrgy throughpur. In a FFT instrument there cnn be n large energy throughput b~cause such elements are absent. This advantage is usually referred to as the Jaequinot advantage (3,

(4) In a FFT experiment both the lowest frequency and the fre- quency resolution are controlled by the time of record (Tn), while the highest frequency (wQ) is controlled by the sampling frequency (hrnD).

(5) In an FFT experiment care has to he taken so that the sam- pling frequency is at least twice as great as the highest frequency in the source otherwise alias resonances may appear.

( 6 ) An FFT spectrometer is a multiplex device in that a single signal channel and detector simultaneously handle all frequencies.

Besides these points the experiment provides a good peda- gogic forum for exemplifying: (a) the properties of noise, (h) A D methods, (c) regression analysis, (d) data averaging, (e) constructive and destructive interference of waves, and (0 boundarv conditions. Althoueh the establishment of stand- ing waves defined by hound& conditions is important both oracticallv (ex.. lasers) and theoreticallv (e.e.. auantum me- - . - . . . - . &

chanics), chemistry students are rarely exposed to a practi- cal example.

Those wishing detailed information about the equipment, including circuits and programs, may obtain this by writing directly to the authors.

Acknowledgment One of us (C.S.) thanks the Research Corporation for

support under grant DS-99.

888 Journal of Chemical Education

Page 5: Teaching FFT principles in the physical chemistry laboratoryagust/kennsla/ee09/vee09/JCE1990p0883_FFT.pdf · Teaching FFT Principles in the physical Chemistry Laboratory ... tube

Literature Cited lo. ~ l h ~ r s , V. M., Ed. S~gg~sfedErporimenta far Laborufory Comas in Acowtie and Vibrofions: Pennsylvanis State University: 1972: pp 25-28.

1. Ramirez, R. W. The FFT hndomenfola and Concepfa; PrenticeHall: Englewood 11. Shaomeker, D. P.; Garland, C. W.: Nibler. J. W. Experiments in Physical Chemisfv.

Cliffs, NJ. 1985. 5thed.:MeGraw-Hill: NcwYork. 1989:pp 113-118. 2. Tho~ndomenlnkofSig~lAnol~ia;A~~licsfionNof.243,Hewlvlett-Ps~~~~d,1985. 12. Seam, F. W.: Zemansky. M. W.: Young, H. D. College Physics: Addison-Wesley:

3. W8yne.R. P. Cham.Er. 1981,W,440-446. Reading, MA, 1986: p MI. 4. Schwanz,L. L. J. Cham. Edur. 1988,65,752-756. 13. Courant, R. Differentid end In~egml Coleulus: Wiley Inteneiene: New York. 1937:

5. Macomber, R. S. J. Chem. Edue. 1985.62.213-214. Vol 1, Chapter 9. 6. Skoog, D. A. Ptineiploa of lnsfrumantol Analysis, 3rd ed.; Saundem: ~ h i l ~ d d ~ h i ~ , 14. Brown, P. B.; Franz,G. N.: Moraff, H.EIertronics for fheModem Scientisf: Elsevier:

,985. New York. 1982: pp 396 .4W03.

7. Glsser, L. J Chrm. Edue. 1981.64, A228-A233, A280-A266,A3C6A313. 15. HorowitL. P.;Hill. W. Th~ArLof~lecffffii~:CccbbidgeU~iii~it~ Ccmhbidge, 198k

8. Chesick, J . P. J. Chem.Edue. l989,66.128-132,283-289,413-413. Chapter 4. 9. Willard, H. H.; Merritt. L. L.; Dean, J. A.; Settle. F. A. Inatrumanto1 Methoda of 16. Meiksin, 2. H.; Thaekrav. P. C. Eleetonic Dcaign with Of-the-Shelf IntWroted

~nolysia, 7th ed.; Wsdsworth: Behonf CA. Circuits: Parker: West Nyaek, NY, 1981: pp 241-244

Volume 67 Number 10 October 1990 887