{VERSION 4 0 "APPLE_PPC_MAC" "4.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 }{CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 256 "" 0 24 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 257 "times new roman" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 258 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 259 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 260 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 261 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 262 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 263 "times" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 264 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 265 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 266 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 267 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 268 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 269 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 270 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 271 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 272 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 273 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 274 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 275 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 276 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 277 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 278 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 279 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 280 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 281 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 282 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 283 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 284 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 285 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 286 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 287 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 288 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 289 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 290 "" 1 14 0 0 0 0 0 2 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 291 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 292 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 293 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 294 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" 18 295 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 296 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 297 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 298 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 299 "" 1 14 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 300 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 301 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 302 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" 18 303 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" 18 304 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" 18 305 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" 18 306 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 307 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" 18 308 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 309 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 310 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 311 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 312 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 313 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" 18 314 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" 18 315 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 316 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" 18 317 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" 18 318 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 319 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 320 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 321 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" 18 322 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 323 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 324 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 325 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 326 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 327 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 328 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 329 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 330 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 331 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 332 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 333 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 334 "" 1 14 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 335 "" 1 14 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 336 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "times" 1 14 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Heading 1" -1 3 1 {CSTYLE "" -1 -1 "times" 1 18 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }1 1 0 0 6 6 1 0 1 0 2 2 0 1 }{PSTYLE "Bullet Item" -1 15 1 {CSTYLE "" -1 -1 "tim es" 1 14 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 3 3 1 0 1 0 2 2 15 2 } {PSTYLE "Fixed Width" -1 17 1 {CSTYLE "" -1 -1 "Courier" 1 10 0 0 0 1 2 2 2 2 2 2 3 1 1 1 }3 1 0 0 0 0 1 0 1 0 2 2 17 1 }{PSTYLE "Title" -1 18 1 {CSTYLE "" -1 -1 "times" 1 18 0 0 0 1 2 1 1 2 2 2 1 1 1 1 }3 1 0 0 12 12 1 0 1 0 2 2 19 1 }{PSTYLE "Author" -1 19 1 {CSTYLE "" -1 -1 "t imes" 1 14 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 1 0 0 8 8 1 0 1 0 2 2 0 1 } {PSTYLE "Normal" -1 256 1 {CSTYLE "" -1 -1 "times" 1 14 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Normal" -1 257 1 {CSTYLE "" -1 -1 "times" 1 14 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Author" -1 258 1 {CSTYLE "" -1 -1 "times" 1 14 0 0 0 1 1 2 2 2 2 2 1 1 1 1 }3 1 0 0 8 8 1 0 1 0 2 2 0 1 }} {SECT 0 {PARA 17 "" 0 "" {TEXT -1 27 " Paradigms in Physics 1" }} {PARA 17 "" 0 "" {TEXT -1 0 "" }}{PARA 17 "" 0 "" {TEXT -1 80 " 1999 O regon State University version November 4, 2002 \+ DMc" }}{PARA 17 "" 0 "" {TEXT -1 6 " " }}{PARA 17 "" 0 "" {TEXT -1 0 "" }}{PARA 18 "" 0 "" {TEXT 256 39 "Fitting Fourier Series to Dat a (Simply)" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 258 "" 0 "" {TEXT -1 37 "by Philip J. Siemens and Kerry Browne" }}{PARA 19 "" 0 "" {TEXT -1 43 "Physics Department, Oregon State University" }}{PARA 0 " " 0 "" {TEXT -1 0 "" }}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 14 " Introduc tion" }}{PARA 0 "" 0 "" {TEXT 257 4 " " }{TEXT 263 128 " The goal o f this worksheet is to gain a first experience of analyzing real-world data using the technique of Fourier Series. " }{TEXT 292 568 "Most \+ of the data from observing the natural world cannot be described by a \+ single simple function, such as a sine or cosine. However many system s behave in a periodic manner; musical notes, the swinging of a tree's branch in the wind, a swingset, the travel of sound and water waves, \+ etc. Fourier Analysis provides a technique to quantify these complex \+ periodic motions. The general idea is that any periodic function that behaves in a not-too-singular manner can be represented as a sum of s ine and cosine functions of suitable amplitude. Mathematically we wri te:" }}{PARA 256 "" 0 "" {XPPEDIT 295 0 "f(t)= a[0]/2 + sum(a[n]*cos( n*omega*t)+ b[n]*sin(n*omega*t),n=1..infinity)" "6#/-%\"fG6#%\"tG,&*&& %\"aG6#\"\"!\"\"\"\"\"#!\"\"F.-%$sumG6$,&*&&F+6#%\"nGF.-%$cosG6#*(F8F. %&omegaGF.F'F.F.F.*&&%\"bG6#F8F.-%$sinG6#*(F8F.F=F.F'F.F.F./F8;F.%)inf inityGF." }{TEXT 296 1 " " }{TEXT -1 1 " " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 293 17 "The coefficients " }{XPPEDIT 18 0 "a[n]" "6#&%\"aG6#%\"nG" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "b[n]" " 6#&%\"bG6#%\"nG" }{TEXT 297 170 " can be chosen to fit the functions w e want to descibe. This operation can be thought of as analogous to d ecomposing a vector as a sum of projections onto basis vectors." }} {PARA 0 "" 0 "" {TEXT 298 1 " " }}{PARA 0 "" 0 "" {TEXT 294 329 " F or this particular worksheet, we will at first import and manipulate t he data. This will be followed by an instructor-led discussion of gen eral features of the data and what we can expect from the Fourier seri es. This will remind us of the purpose of different terms in the ser ies, which we experienced in the Maplesheet " }{TEXT 299 15 "fourier-s quare " }{TEXT 333 3 "and" }{TEXT 334 18 " fourier-triangle." }{TEXT 300 94 " We will use the math developed in class to give us answers f or the coefficients. Remember: " }}{PARA 15 "" 0 "" {TEXT 301 50 "Foc us on the overall effects from different terms " }}{PARA 15 "" 0 "" {TEXT 302 26 "Try to guess the causes. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 330 61 "CHOOSE [OPTIONS] [PLOT DISPLAY] [ INLINE] FROM THE MENUS ABOVE" }}{PARA 0 "" 0 "" {TEXT -1 55 "So that y ou can easily print out a record of your work." }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 16 " Importing Data" }}{PARA 0 "" 0 "" {TEXT 260 315 " \+ Before we delve into the math, let's import the data from our acco unts. Remember, this data represents the angle vs. time movement of a freely swinging pendulum. Our first step is to start the libraries or packages that we'll be using for the worksheet. This allows us to us e Maple's pre-defined procedures." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {EXCHG {PARA 257 "> " 0 "" {MPLTEXT 1 0 33 "restart:with(linalg):with( plots):" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 324 582 "After the laboratory session, the data collected by the laborator y computer was transferred into files in the server of the computer la boratory. For example, the first file is called `/home/mathphys/parad igm1/data/Pend1.dat`. The other data sets are numbered Pend2.dat, etc . Available sets as of 11/9/01 are: 1-7. The duration of the data scan is 2.6 seconds. For this data, an angular change of 90 degrees \+ corresponds to 55 steps in the vertical data for sets 1-5, and 3 times as many steps for data sets 6 & 7 (i.e., the scale was changed to mag nify the last 2 data sets)." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 261 144 "To import the data we use a readdata operatio n. We first enter the number of points in each file and the time durat ion of the scanned data set. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "npts:=500:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "time_scan:=2.6:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 65 "volt_data:=readdata(`/home/mathphys/paradigm1/da ta/Pend1.dat`,1):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "time_d ata:=[seq(time_scan/npts*i,i=1..npts)]:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 320 197 "The result is two lists of data points \"time_data\" an d \"volt_data\". We ended the Maple commands with a colon instead of \+ a semicolon so that we wouldn't get a listing of this table on our scr een. " }{TEXT -1 225 "The time information is stored in the time_data variable and voltage information is stored in the volt_data variable. We have assumed there are npts=500 points. If you use other data fil es, you will have to modify this part." }}}{EXCHG {PARA 0 "" 0 "" {TEXT 329 73 "We can look at this input table graphically, using the f ollowing command:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 59 "setopt ions(labels=[`Time(s)`,`Volts`],font=[HELVETICA,12]):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 70 "pointplot([seq([time_data[n],volt_d ata[n]],n=1..npts)],connect=false);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 321 35 "It is just a collection of points (" }{XPPEDIT 322 0 "(V[n],t[ n])" "6$&%\"VG6#%\"nG&%\"tG6#F&" }{TEXT 323 90 "). We can see with ou r eyes what the function is by imagining that we connect the dots. " }{MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT 262 215 "Remember, the rea son the vertical axis is in volts is due to the fact that our measurin g device was a potentiometer. Our calibration, however, shows that th e voltage is linearly related to the angular displacement." }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 22 " Features of the Data" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 258 668 " As you can see from the graph, we have a very general periodic function. It is disp laced from the origin in volts and phase shifted in time. This will c omplicate our analysis, introducing terms into the Fourier series whos e effect is difficult to guess. To ease our burden, we will redefine \+ our origin and work in the changed variables. Let's first shift the \+ function down to the axis. To do this we subtract the value of the eq uilibrium position from our function. We measured this in the lab, bu t let's check it again here, since the data you are using here may dif fer from the data you took in the lab. (REMEMBER TO ADD A SEMI-COLON \+ AFTER YOUR ENTRY) " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 23 "vmax:=max(volt_data[]);" }}{PARA 0 "> " 0 " " {MPLTEXT 1 0 23 "vmin:=min(volt_data[]);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "vmiddle:=(vmax+vmin)/2;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "equilibrium_position:=;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "amplitude:=(vmax-vmin)/2;" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 51 "volt_sub:=map(x->x-equilibrium_position,volt_data): " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 68 "pointplot([seq([time_da ta[n],volt_sub[n]],n=1..npts)],connect=true);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 291 288 "This should put the fun ction almost symmetrically distributed around the time axis. From t he graph it should be easy to read the time shift from the origin to t he first zero crossing. You could replot with reduced range (i.e., n= 10..20) to read the time shift better. Enter it below." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 257 "> " 0 "" {MPLTEXT 1 0 16 "time_ shift:=; " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "time_sub:=ma p(x->x-time_shift,time_data):" }}}{PARA 0 "" 0 "" {TEXT -1 227 "We hav e to convert the time shift into a index shift, since we need to keep \+ track of which points correspond to which time. First find the time p er point, and then use this to find the point corresponding to the axi s crossing." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "delta_t:=time _data[2]-time_data[1];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "n um_shift:=round(time_shift/delta_t);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 75 "pointplot([seq([time_sub[n],volt_sub[n]],n=num_shift. .npts)],connect=true);" }}}{PARA 0 "" 0 "" {TEXT 259 3 " " }}{PARA 0 "" 0 "" {TEXT 289 153 " Notice with these new variables, the fu nction has the look of a sine function. Specifically, it appears to b e an odd function of the shifted time " }{XPPEDIT 306 0 "t" "6#%\"tG" }{TEXT 307 1 "," }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 256 "" 0 "" {TEXT 310 1 " " }{XPPEDIT 308 0 "f(t) = -f(-t)" "6#/-%\"fG6#%\"tG,$-F% 6#,$F'!\"\"F," }{TEXT 309 3 ". " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT 311 252 "It follows from this that, in these new coordinates, only the SINE terms of the series will be important, the cosine being an even function. This will be more apparent when we co nfront the technique mathematically. So our expansion is expected to \+ be:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 256 "" 0 "" {XPPEDIT 303 0 "g[nmax](t)=sum(b[n]*sin(n*omega*t),n=1..nmax)" "6#/-&%\"gG6#%%nmaxG 6#%\"tG-%$sumG6$*&&%\"bG6#%\"nG\"\"\"-%$sinG6#*(F2F3%&omegaGF3F*F3F3/F 2;F3F(" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 264 91 " The first step in any Fourier analysis is to determine the fu ndamental frequency, the " }{XPPEDIT 18 0 "omega" "6#%&omegaG" }{TEXT 332 476 " in the equation above. A periodic function is a function th at has a basic waveform that is repeated again and again. That basic \+ waveform varies over a given period that determines the fundamental fr equency for our Fourier expansion. As you can see from the data, we have included only slightly more than this period. Enter below your \+ value for the period. Again, you could replot to read the value bette r. This will give you better results for the calculations below." }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 257 "> " 0 "" {MPLTEXT 1 0 10 "Period:=; " }}}{EXCHG {PARA 257 "> " 0 "" {MPLTEXT 1 0 19 "omega :=2*Pi/Period;" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 265 6 "where " }{XPPEDIT 18 0 "omega" "6#%&omegaG" }{TEXT 331 30 " is our fundamental frequency." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 58 "Now find the index corresponding to the e nd of one period." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "num_per iod:=round(Period/delta_t)+num_shift;" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 44 " Exploring the Spectrum with Mathematics " }}{PARA 3 " " 0 "" {TEXT 290 239 " In class, and in the notes on Fourier Series, equations were derived that allow you to calculate the coefficients o ne at a time. What we'd like to do now is use these formulas and comp are the result with our guesses. The formulas are:" }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}{PARA 256 "" 0 "" {XPPEDIT 18 0 "b[n]=(2/T)*(int(f(t )*sin(n*omega*t),t=0..T))" "6#/&%\"bG6#%\"nG*(\"\"#\"\"\"%\"TG!\"\"-%$ intG6$*&-%\"fG6#%\"tGF*-%$sinG6#*(F'F*%&omegaGF*F4F*F*/F4;\"\"!F+F*" } }{PARA 256 "" 0 "" {TEXT -1 0 "" }}{PARA 256 "" 0 "" {XPPEDIT 304 0 "a [n]=2/T*int(f(t)*cos(n*omega*t),t=0..T)" "6#/&%\"aG6#%\"nG*(\"\"#\"\" \"%\"TG!\"\"-%$intG6$*&-%\"fG6#%\"tGF*-%$cosG6#*(F'F*%&omegaGF*F4F*F*/ F4;\"\"!F+F*" }}{PARA 256 "" 0 "" {TEXT -1 0 "" }}{PARA 256 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT 266 33 "We argued that th e coefficients " }{XPPEDIT 305 0 "a[n]" "6#&%\"aG6#%\"nG" }{TEXT 267 130 ", the cosine terms, should all be zero, because the data is an od d function and cosine is an even function. Let's take a look at " } {XPPEDIT 18 0 "a[1]" "6#&%\"aG6#\"\"\"" }{TEXT 325 64 " and see why th ese statements are justified. The integrand for " }{XPPEDIT 18 0 "a[1 ]" "6#&%\"aG6#\"\"\"" }{TEXT 326 6 " is: " }{MPLTEXT 1 0 0 "" }}} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 68 "a1_integrand:=[seq(volt_sub[i]*cos(1*omega*time_sub[i]),i=1..npts) ]:" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 268 34 "L ooking at a plot of this we find:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 85 "pointplot([seq([time_sub[n], a1_integrand[n]],n=num_shift..num_period)],connect=true);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 269 314 "As much area is above the axis as below. Thus the integral will be approximately zer o. THIS IS A GENERAL RESULT OF MULTIPLYING AN EVEN FUNCTION BY AN ODD FUNCTION AND INTEGRATING OVER A COMPLETE PERIOD. This is the reason \+ all of the COSINE terms were assumed away above. This is a good trick, worth remembering." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 " " {TEXT 274 192 " On the other hand, with our definitions above, w e can go ahead and calculate the integral arriving at a numerical va lue for the coefficient. This will undoubtedly not be exactly zero. \+ " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 312 9 "WHY N OT? " }}{PARA 0 "" 0 "" {TEXT 275 1 " " }}{PARA 0 "" 0 "" {TEXT 313 126 " We will do the integral using the simplest procedure possible -- summing up the integrand at each point in the interval. " }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 78 "a1_calc:=evalf(add(a1_integrand[i],i=num_shift..num_period)*delta_ t*2/Period);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 276 58 "As you can see this value is close to but not quite zero . " }}{PARA 256 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 277 41 " We guessed in the last section that " }{XPPEDIT 314 0 "b[1]" "6#& %\"bG6#\"\"\"" }{TEXT 278 74 "would have a non-zero value. You should be able to estimate the value of " }{XPPEDIT 256 0 "b[1]" "6#&%\"bG6# \"\"\"" }{TEXT 335 1 " " }{TEXT 336 86 "from your data plots above. L et's use the same arguments as above to see what we get." }}{PARA 0 " " 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 68 "b1_in tegrand:=[seq(volt_sub[i]*sin(1*omega*time_sub[i]),i=1..npts)]:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 85 "pointplot([seq([time_sub[n], b1_integrand[n]],n=num_shift..num_period)],connect=true);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 270 82 "As you can see t he integral of this will have some nonzero result. The result is:" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 257 "> " 0 "" {MPLTEXT 1 0 78 "b1_calc:=evalf(add(b1_integrand[i],i=num_shift..num_period)*delt a_t*2/Period);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 271 22 " The coefficient, " }{XPPEDIT 315 0 "b[2]" "6#&%\"bG6#\"\"#" }{TEXT 272 85 ", was argued a way as zero. Let's use our analysis and get a better feeling for this ." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 68 "b2_integrand:=[seq(volt_sub[i]*sin(2*omega*time_sub[i ]),i=1..npts)]:" }}}{EXCHG {PARA 257 "> " 0 "" {MPLTEXT 1 0 85 "pointp lot([seq([time_sub[n],b2_integrand[n]],n=num_shift..num_period)],conne ct=true);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 273 152 "This shows a problem similar to the cosine terms. The cause is also similar. Around 0.25*Period, the data is symmetric or even. \+ Around 0.25*Period, " }{XPPEDIT 317 0 "sin(2 omega t)" "6#-%$sinG6#*( \"\"#\"\"\"%&omegaGF(%\"tGF(" }{TEXT 316 116 " is anti-symmetric or od d. This causes the now-familiar cancelling effect for these terms. T he resulting value is:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 257 "> " 0 "" {MPLTEXT 1 0 78 "b2_calc:=evalf(add(b2_integrand[i ],i=num_shift..num_period)*delta_t*2/Period);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 279 206 " The next terms pr ovide no new features to be understood and are just the implementation of the above ideas. Therefore we will go through them with no words \+ and just get the values of the first three " }{XPPEDIT 18 0 "a" "6#%\" aG" }{TEXT 327 5 " and " }{XPPEDIT 18 0 "b" "6#%\"bG" }{TEXT 328 116 " coefficients. We will then use them as we did with our guesses in th e last section and see if the fit is improved." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 257 "> " 0 "" {MPLTEXT 1 0 68 "a2_integra nd:=[seq(volt_sub[i]*cos(2*omega*time_sub[i]),i=1..npts)]:" }}}{EXCHG {PARA 257 "> " 0 "" {MPLTEXT 1 0 85 "pointplot([seq([time_sub[n],a2_in tegrand[n]],n=num_shift..num_period)],connect=true);" }}}{EXCHG {PARA 257 "> " 0 "" {MPLTEXT 1 0 78 "a2_calc:=evalf(add(a2_integrand[i],i=nu m_shift..num_period)*delta_t*2/Period);" }}}{PARA 257 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 257 "> " 0 "" {MPLTEXT 1 0 68 "b3_integrand:=[s eq(volt_sub[i]*sin(3*omega*time_sub[i]),i=1..npts)]:" }}}{EXCHG {PARA 257 "> " 0 "" {MPLTEXT 1 0 85 "pointplot([seq([time_sub[n],b3_integran d[n]],n=num_shift..num_period)],connect=true);" }}}{EXCHG {PARA 257 "> " 0 "" {MPLTEXT 1 0 78 "b3_calc:=evalf(add(b3_integrand[i],i=num_shif t..num_period)*delta_t*2/Period);" }}}{PARA 257 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 257 "> " 0 "" {MPLTEXT 1 0 68 "a3_integrand:=[seq(volt_ sub[i]*cos(3*omega*time_sub[i]),i=1..npts)]:" }}}{EXCHG {PARA 257 "> \+ " 0 "" {MPLTEXT 1 0 85 "pointplot([seq([time_sub[n],a3_integrand[n]],n =num_shift..num_period)],connect=true);" }}}{EXCHG {PARA 257 "> " 0 " " {MPLTEXT 1 0 78 "a3_calc:=evalf(add(a3_integrand[i],i=num_shift..num _period)*delta_t*2/Period);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 280 131 " Now, with several coefficients, let's se e how good the fit is, using all the coefficients we have or just usin g the main term:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 257 " > " 0 "" {MPLTEXT 1 0 231 "fit:=[seq(b1_calc*sin(1*omega*time_sub[i]) \+ + a1_calc*cos(1*omega*time_sub[i]) + b2_calc*sin(2*omega*time_sub[i]) \+ + a2_calc*cos(2*omega*time_sub[i]) + b3_calc*sin(3*omega*time_sub[i]) \+ + a3_calc*cos(3*omega*time_sub[i]),i=1..npts)]: " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 59 "fit_b1:=[seq(b1_calc*sin(1*omega*time_sub[i]) ,i=1..npts)]: " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 76 "p1:=point plot([seq([time_sub[n],fit[n]],n=1..npts)],connect=true,color=red):" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 82 "p2:=pointplot([seq([time_s ub[n],volt_sub[n]],n=1..npts)],connect=true,color=blue):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 81 "p3:=pointplot([seq([time_sub[n],fit _b1[n]],n=1..npts)],connect=true,color=green):" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 220 " The blue curve is t he original data set, the red curve is the Fourier series using all 6 \+ terms you calcultaed above, and the green curve is just the harmonic s ine part of the Fourier series (i.e., just the b1 term)." }}{PARA 0 " " 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "displ ay(p1,p2,p3);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 281 211 " You could copy and adjust the above commands to ge t the coefficients for higher harmonics and get an even better fit (as if you didn't have enough work). This however is left for the extrem ely motivated. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 282 278 " You will also find that there are predefined compu ter operations that calculate many of the coefficients of the Fourier \+ spectrum for you. An especially popular method, called the Fast Fouri er Transform (FFT), relies on having the data measured at equally-spac ed values of " }{XPPEDIT 318 0 "t" "6#%\"tG" }{TEXT 319 74 ". There \+ is also a Fourier Integral Transform for non-periodic functions." }}} {SECT 1 {PARA 3 "" 0 "" {TEXT -1 14 " Data Summary" }}{PARA 0 "" 0 " " {TEXT -1 82 "This section will print out a summary of your results f or one particular data set." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 201 "printf(`Amplitude = %g\\nEquil. Po sition = %g\\nPeriod = %g\\nb1 = %g\\nb2 = %g\\nb3 = %g\\na1 = %g\\na2 = %g\\na3 = %g`, amplitude,equilibrium_position,Period,b1_calc,b2_cal c,b3_calc,a1_calc,a2_calc,a3_calc);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 9 " Summary" }}{PARA 0 "" 0 "" {TEXT 283 123 " This worksheet has provided us with some useful ins ights to keep in mind when looking at a complicated periodic signal:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 15 "" 0 "" {TEXT 284 109 "A co mplicated periodic signal can be approximated by summing sines and cos ines with appropriate coefficients." }}{PARA 15 "" 0 "" {TEXT 285 133 " It is important to determine the fundamental frequency of the period ic signal. This will be the frequency of the Fourier expansion." }} {PARA 15 "" 0 "" {TEXT 286 93 "Taking advantage of even-odd symmetry a llows quick accurate guesses of specific coefficients." }}{PARA 15 "" 0 "" {TEXT 287 63 "Using the integral formula yields the coefficients \+ immediately." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 5 " " }{TEXT 288 201 "Fourier decomposition allows a powerful w ay to quantify the differences between signals, for each will have its own Fourier spectrum. This will be put to many far-reaching uses in \+ your future studies." }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{MARK "5 0" 39 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }