The Excel FFT Function v1.1
The Excel FFT Function v1.1
1
P. T. Debevec
February 12, 2006
The discrete Fourier transform may be used to identify periodic structures in time
series data. Suppose that a physical process is represented by the function of time, h ( t ) .
The function is sampled at N times, tk = k t where k = 0,1, 2,..., N 1 . From these N
measurements, h k , N complex amplitudes, H n , are determined which satisfy the N
equations
N 1
Hn = h k e
ik
2 n
N
k =0
hk=
N 1
1
N
Hn e
i n
2 k
N
n =0
N 1
1
N
H
n=0
e i notk .
The right-hand side is the discrete analogue to the complex form of the Fourier expansion
h(t ) =
ce
n =
in o t
1
cn =
To
To
0 h(t ) e
in o t
dt .
The Excel data analysis package has a Fourier analysis routine which calculates
the complex coefficients, H n , from the time series data, h k . The routine requires that
the number of samples in the time series data be a power of 2, i.e. N = 2m . The example
in this note uses N = 2048 . The Excel function is not well documented, but it is
straightforward to use. This note describes the Excel worksheet, Fourier_example.xls,
which is in the Physics 401 web site under Tutorials and Lectures, Experiment 10.
The time series data in this example are obtained from sampling a function
describing the free decay of a torsion oscillator for time t > to ,
( t ) = Ae a(t t ) sin ( 2 f ( t to ) ) .
o
The function is calculated in time steps of 0.020 s, which corresponds to sampling rate of
50.0 Hz. The time series data are shown in the Fig. 1 below.
fre e de cay dampe d oscillator
6000
raw counts
4000
2000
0
-2000
-4000
-6000
0
10
15
20
25
30
35
40
time (s)
For Input Range enter $B$3:$B$2050, the location of the time series data, and for output
range enter a convenient place on the worksheet, for example, $J$3:$J$2050. After
selecting the OK button, Excel returns in column J the complex coefficients, 2048 of
them. A portion of column J is shown in Fig. 3 below.
500
400
300
200
100
0
0
10
15
20
25
frequency (Hz)
Fourier power
1.0E+03
1.0E+01
1.0E-01
1.0E-03
0
10
15
frequency (Hz)
20
25
The normalization adopted in this note has a convenient property. Define the
mean squared amplitude of the time series data as
mean squred amplitude =
1
N
N 1
( tk ) .
k =0
The square of the amplitude is calculated in column C. The mean squared amplitude is
calculated in cell F19. For these data it has the value of 1105488.754. A pure sine wave
with an amplitude of 2 , for which an integral number of periods occur in the total
sampled time, has a mean squared amplitude of unity. Thus the mean squared amplitude
has the same role as the rms value of a periodic function. The total Fourier power, the
sum of the entries in column Q, is calculated in cell G19. For these data it also has the
value of 1105488.754, because of the normalization. If only the relative power in
different frequency bins is needed, then the normalization is not required. The relative
power is given by the square of the modulus of the Excel output directly.