You are on page 1of 3

1

Testing the Validity of the Fourier Series Using a


Function Generator
B. Dolle (Bridgewater State University Physics and Mathematics)

I. A BSTRACT Noting that sin 0 = 0 and cos 0 = 1, we can change the index
from W → N such that Eq 1 can be written
In this study we check the validity of the Fourier Series

in predicting a wave form’s frequency spectrum. The Fourier a0 X
Series uses an infinite sum over a complete basis set in f (t) = + (an cos nωt + bn sin nωt) . (2)
2 n=1
L2 space to generate a signal. Because infinite sums are
impractical, function generators approximate a signal. Using where τ = 2/T , a0 /2 is the vertical shift of the function,
custom software, we collected data from a function generator 1 τ
Z
for two different wave forms and compared the coefficients to an = f (t) cos(nωt)dt (3)
τ −τ
theoretical values. We report reduced χ2 values of 1.03 for the
square wave and 2.62 for the triangle wave, suggesting great and Z τ
fit of the model to experiment. bn = f (t) sin(nωt)dt. (4)
−τ

It is important to note that the coefficients an and bn tell


II. I NTRODUCTION
us how much of each frequency is included to make up our
One of the most important developments in signal signal f (t).
processing theory is that of the Fourier Series. The Fourier
Series is a method to mathematically separate a function into In this study, we are primarily concerned with three
its different frequencies. Some frequencies contribute more wave-forms: square wave, sine wave and triangle wave.
than others and the Fourier series also provides a way to find
the weights of each frequency. Square Wave

The purpose of this experiment is to use the Fourier


Series to predict how much of each frequency goes into
generating a particular wave form. Specifically we wish to
experimentally verify the theoretical predictions of the weight
for each basis function.

III. T HEORY
The Fourier Series mathematically describes the fact that
any periodic function is an element of an infinite-dimensional
function space. The basis-functions of the Hilbert Space Fig. 1. Square wave with amplitude A, period 2T.
described above (L2 ) are of the form sin nωt and cos nωt
where n ∈ W. Any function can be described as an infinite The square wave (Fig 1) has the equation
combination of these basis functions, with projection weights. 
−A; −T < t < 0;
f (t) =
A; 0 < t < T .
For a more physical description, the Fourier Series is a
transformation of a periodic function from time-space to Because the function is odd, all an coefficients are 0 and
frequency-space. We may observe a signal, which is a 4A
combination of many frequencies put together. The Fourier bn =
. (5)

Series of the signal tells us how much of each frequency is We find the Fourier Series of the wave form to be
included in the signal in question. ∞  
4A X 1 (2n − 1)
f (t) = sin t . (6)
We describe any periodic signal of period T from the π n=1 2n − 1 T
time domain to be

X ∞
X
f (t) = an cos nωt + bn sin nωt. (1)
n=0 n=0
2

Triangle Wave

Fig. 4. Experimental setup where the signal from a function generator is


processed by a Data Acquisition Device (DAQ) and sent to a computer to be
saved.

Fig. 2. Triangle wave form with amplitude A and period T.


IV. E XPERIMENT
The equation for the triangle wave (Fig 2) is
 2At In this experiment, we used a function generator to generate
− T ; −T /2 < t < 0; three signals: a square wave, sine wave and triangle wave.
f (t) = 2At
T ; 0 < t < T /2. These signals were sent to a computer through a Data Acqui-
Our triangle wave was considered with a period π in mind. sition Device. Using custom Fourier transform, the computer
Exploiting symmetry, we find that the bn coefficients are 0, displayed the signal in a frequency domain and wrote the data
a0 = A and to a file readable by Excel.
2A
an = [cos (nπ − 1)]. (7)
(nπ)2 V. DATA A NALYSIS
Thus the triangle wave has the Fourier Series We plotted our data into Excel. To refine the raw data, we
∞ deleted all data except signal peaks. This allowed us to view
A 2A 1X
only the frequencies with non-zero coefficients.
f (t) = + 2 [cos (nπ − 1) cos (2nπ)]. (8)
2 π n=1 n2
We used a χ2 and reduced χ2 to test goodness of fit for our
It should be noted that our experiment concerns the case
model. We found serious dispute between the theoretical and
where the triangle wave is centered about 0V and thus the
experimental voltages, so instead we normalized all the data.
an ’s require adjustment.
This allowed us to compare the ratios of the peaks instead of
the values. Then we compared experimental and theoretical
Taking the shift of a0 = A into consideration, we found the
coefficients for χ2 . We took an error of 5.5mV for square,
adjusted coefficients to be
9.0mV for triangle and 7.0mV for the sine wave.
4A
an = . (9)
(nπ)2 VI. R ESULTS
Sine Wave Experimental and theoretical values (TABLE I and II) were
plotted for each wave form (shown in Fig 3, Fig 4 and Fig
5).

Fig. 3. Sine wave with amplitude A and period T.

The equation of a sine wave of frequency ω and amplitude A


(Fig 3) is
f (t) = Asin(mωt). (10)
Fig. 5. Square wave data plotted as frequency vs. amplitude (experimental
This is a trivial case, where the coefficients values in blue, theoretical in orange) (note that the error bars are too small
to see).
a0 = 0 = an = bn6=m , bn=m = 1
Fourier Series of the sine wave is just The error bars were so small for each waveform, that although
plotted, they can not be seen. We found a reduced χ2 value
f (t) = A sin (mωt). (11) of 1.03 for the square wave. We had 30 data points and took
3

Frequency(Hz) Experiment Theory


1010 1.00 1.00
3000 0.35 0.34
4990 0.19 0.20
6990 0.15 0.14
8980 0.11 0.11
10980 0.08 0.09
12970 0.08 0.08
14960 0.07 0.07
16960 0.06 0.06
18950 0.05 0.05
20940 0.04 0.05
20950 0.04 0.05
22940 0.04 0.04
24930 0.04 0.04
26930 0.03 0.04
28920 0.04 0.03 Fig. 6. Triangle wave data plotted as frequency vs. amplitude (experimental
30910 0.03 0.03 values in blue, theoretical in orange) (note that the error bars are too small
30920 0.02 0.03 to see).
32910 0.03 0.03
34900 0.03 0.03
36890 0.02 0.03
36900 0.02 0.03
38890 0.03 0.03
40880 0.02 0.02
40890 0.02 0.02
42880 0.02 0.02
44870 0.02 0.02
46860 0.02 0.02
46870 0.02 0.02
48860 0.02 0.02
TABLE I
N ORMALIZED EXPERIMENTAL AND THEORETICAL VALUES FOR THE
SQUARE WAVE LISTED BY FREQUENCY (H Z ).

Frequency(Hz) Experiment Theory Fig. 7. Sine wave data plotted as frequency vs. amplitude (experimental
1000 1.00 1.00 values in blue, theoretical in orange) (note that the error bars are too small
2990 0.10 0.11 to see).
4970 0.04 0.04
6950 0.02 0.02
7750 0.00 0.02
TABLE II However, we saw two small harmonics at f =1990Hz and
N ORMALIZED EXPERIMENTAL AND THEORETICAL VALUES FOR THE 2990Hz for the sine wave, which clearly should have been
TRIANGLE WAVE LISTED BY FREQUENCY (H Z ) 0. This suggests that the function generator is not able to
perfectly fit the Fourier Series, but the extra harmonics were
well suppressed.
degrees of freedom to be 29.
We report reduced χ2 values of 1.03 for the square
We found reduced χ2 of 1.07 for the triangle wave. We wave, 1.07 for the triangle wave and .997 for the sine wave.
had only 5 data points, corresponding to 4 degrees of freedom. Thus, overall, the experiment was a great success and the
Fourier Series is a great description of the signals generated
The sine wave model returned a reduced χ2 of .977, by the function generator.
using 2 degrees of freedom.
VIII. C ONCLUSION
VII. D ISCUSSION The Fourier Series is a great way to theoretically predict the
frequencies that a function generator will use when providing
The Fourier Series is based on infinite sums of frequencies, a signal. We report reduced χ2 values of 1.03 for the square
however infinite sums are impossible in practice. Thus, a wave and 2.62 for the triangle wave, suggesting great fit of
function generator will use a finite amount of frequencies the model to experiment.
to approximate the desired signal. Adding more terms
will increase the accuracy of the signal, but requires
more sophisticated technology. Our experiment to test the
approximations of the function generator delivered desirable
results.

We expected to find odd harmonics for both the square


wave and the triangle wave, which is precisely what we saw.
Notice the frequency peaks at 1, 3, 5, 7kHz respectively.

You might also like