physics 15c: laboratory 2: fourier series scphys/courses/15c/15c_2.pdf · figure 1: three waveforms
Post on 30-Jul-2018
Embed Size (px)
Phys 15c: Lab 2, Spring 2007 1
Physics 15c: Laboratory 2: Fourier SeriesDue Friday, february 23, 2007, before 12 Noon in front of SC 301
REV 0:1 ; February 15, 2007
Lab Hours: not quite the usual lab hours!
This lab can be done on any of the Science Center PCs, and you can do it completely on your own, if you like. Wehave scheduled some help lab hours. These sessions will be held in room SC 226, the PC classroom. As youcome out of the elevators turn almost a U-turn to your left, and 226 is about 2/3 the way down the hall. Since someof you will do the labs on your own time, we havent tried to duplicate lab hours fully. At the time of these listedhelp labs, you will find Mark or Kevin on hand to help. During those hours, we have priority (we wont use theentire room, so well share it, of course).
We expect you to arrive with Fourier series equations done or at least attempted. We do, of course, want you tocome to help labs for help!but make your own attempt to solve the problems before you arrive. Were verysympathetic to people who have tried, and find themselves baffled; were less sympathetic to a person who showsup and looks at the lab for the first time, asking, What do I do? We know you wouldnt do that; but some peoplehave done that in past terms.
Help lab hours are as follows:
Please note that these are NOT your usual lab section times!
Tuesday, Feb. 20, 3-4 p.m.;
Wednesday, Feb. 21, 3-4 p.m.;
Thursday, Feb. 22, 8-9 p.m.
Make sure you read this lab handout and do the calculations before you go to the lab.
An important property of many types of waves is linearity. For example, two sounds of different frequencies can beplayed at the same time and the resultant sound is simply the addition of the amplitudes of the two original soundwaves. (Your ear does a fast frequency-analysis of the sounds it receives, using tunable resonant structures : theso-called cilia, little hairs in your inner ear.) The fact that the sound is as simple as the addition of the twoamplitudes is a mathematical property of the wave equation. The property holds true for many different wavephenomena (e.g. sound, light, quantum mechanics). (That this should be true may not be obvious at first glance. Infact, in some extreme limits linearity no longer holds true. Fortunately, many interesting phenomena exist in thelinear regime.)
In this lab you will learn about Fourier series. It turns out that any periodic wave can be obtained by adding up theproper series of sine and cosine waves. The proper series depends on the wave. The mechanism for determining
1Revisions: show changed path and procedure for invoking 15c files.
Phys 15c: Lab 2, Spring 2007 2
that series is described below. You will add waves together on a computer to verify your determination of theproper series for describing square, triangle and saw-tooth waves. You will be able to listen to your results. Youwill also add some waves to produce various types of musical sounds.
A Fourier series is an infinite sum of harmonic functions (sines and cosines) with every term in the series having afrequency which is an integral multiple of some principal frequency and an amplitude that varies inversely withits frequency. The usefulness of such series is that any periodic function f with period T can be written as aFourier series in the following way:
f(t) = a0 +
ancos nt +
where the coefficients are given by
0f(t) dt (1)
0f(t) cos nt dt (2)
0f(t) sin nt dt (3)
and = 2T . The formulas for the coefficients can be easily obtained from the following orthogonalityconditions2:
0sin nt cos mt dt = 0 (4)
0cos nt cos mt dt =
0sin nt sin mt dt =
(Aside: The above formalism is expressed for a function of time with period T and frequency = 2T , but theseformulas are equally valid for function of position; one need just replace T with the spatial period (or wavelength) and with the spatial frequency k = 2 .)
2The notation, n,m, used below, defines a variable that takes the value zero where n 6= m and one where n = m.
Phys 15c: Lab 2, Spring 2007 3
We are now going to discuss some formalism of three-dimensional vectors expressed in Cartesian coordinates, forthe purpose of making comparisons to Fourier series. In Cartesian space, any vector can be written as a linearcombination of the mutually perpendicular basis vectors x, y, z in the following way:
~V = Vxx + Vyy + Vz z,
where the coefficients are given by
Vx = ~V x, Vy = ~V y, Vz = ~V z.
The above expressions for the coefficients can be easily derived from the following perpendicularity (or, moregenerally, orthogonality) relations:
x y = y z = z x = 0,
x x = y y = z z = 1.
It is obvious what all the vector notation stands for: the unit vectors are elements that we are combining to makesome general vector ~V , and the components Vi are the amount of each element we need to add together tomake our final product, the vector ~V . The orthogonality conditions simply express that the basis vectors x, y, and zare linearly independent. Although this section about vectors is elementary and may appear unnecessary, we willsee presently ( and you may have figured it out by now) there are similarities between this vector formalism andthat of the Fourier series.
2.2 Comparison between Vectors and Fourier Series
The two previous sections were written suggestively, to make comparisons between the formalism for the Fourierseries and for vectors. The similarities between the two can provide us with some insight about Fourier series (forthose with knowledge of linear algebra, these similarities arise since we can create inner product sources for boththree-dimensional vectors and for periodic functions of a given period). It should be clear that the harmonicfunctions making up a periodic function are analogous to the unit vectors making up a vector, and the coefficientsan, bn in a Fourier series are analogous to the components Vi of a vector:
cos, sin x, y, z
an, bn Vx, Vy, Vz
So, the harmonic functions are the elements that go into making a certain periodic function (they will be the samefor all functions with the same period), and the coefficients are the amount of each harmonic we need to make theparticular function. This way of thinking about Fourier series is extremely powerful and will serve you well ifyou learn it now. So, if you have any doubts that you fully understand the idea, reread the previous section and talkabout it with others until you do understand.
Phys 15c: Lab 2, Spring 2007 4
Before doing the experiment in lab, you will need to calculate the Fourier coefficients for several periodicfunctions: a square wave, a triangular wave, and a saw-tooth wave.
NOTE an example in which we have calculated the Fourier components for a given waveform appears as ahand-written appendix to these notes. 3
These coefficients are just relative scaling factors. It is useful to characterize functions as odd or even: evenfunctions are those symmetric about time zero: unchanged by rotation about the f(t) axis; f(-t) = f(t). Odd functionsare inverse about the f(t) axis: f(-t) = -f(t). Even functions will be represented by cosines, odd functions by sines,and some functions are not purely even or odd and thus will need both sine and cosine. By the way, make sureyoure consistent in your use of units as you evaluate the integrals: use seconds or milliseconds, but dont wobblebetween the two. You will use these functions throughout the lab. The three waves whose Fourier series wed likeyou to calculate are shown in the figure just below:
Figure 1: Three Waveforms for you to Synthesize
3.2 Fourier Synthesis on the Computer
In this part of the lab you will construct periodic functions (square wave, etc.) by adding harmonic waves of theright frequency and amplitude. You will do this by using a program running on a computer. You will be able tolisten to the resultant wave because the computer you will use is equipped with a chip called a DAC, a device that
3Thanks to Anita for doing this. It seemed to me unfair to assume that students could simply teach themselves to go through this process,if they happened not to have seen the technique before.
Phys 15c: Lab 2, Spring 2007 5
converts the string of numbers or codes that represent the wave in the digital domain into a succession of voltagesin the analog domain. These voltages can be sent out to speakers or headphones so that your (analog-) ears cansense the waveform that they represent.
The program that you will do this is MATLAB (running another program especially designed for this lab, aprogram named thelab). You can access the program through the PCs networked at the Science Center.
3.3 Starting up Matlab
Go to one of the PCs in the science center. Log in, using your fas login.
In principle, all youll need do is open the Matlab program, and then invoke the program written in Matlabslanguage for this 15c exercise. A preliminary step is necessary, though, in order to let Matlab know where to findthat program, and the routines that it invokes.
Preliminary: place the 15c programs in what looks to your computer like an additional drive:
use the START menu, click on RUN, and enter CMD in the window that appears. This will open acommand window.
at the cursor, type
net use R: \\Dsssoft10\Courses\Physics15c