How to use these equations? Three methods to evaluate the Fourier Coefficients of a Fourier Series Define a function to evaluate: A f( t ) 10 f0 A. 10 T t T 1 f0 ω0 2 . π . f0 This is a sawtooth wave Time period of wave T = 0.1 Note: This function is only valid to describe the sawtooth in the range 0 to T. First Method Use mathcad (or equivalent) to calculate the integral numerically. Use the function f(t) defined above and the definition of b3 from [10.2c] b3 2 . T T 0 f( t ) . sin 3 . ω 0 . t dt Mathcad evaluates this as: b3 = 1.061 Second Method Graph the function multiplied by the appropriate sine or cosine wave, then count the squares on the graph by hand. REMEMBER: Points below the line are NEGATIVE! Plot the curve in the range: t Area of each square = 0, T .. T 100 0.1 . 20 3 = 1.25 10 40 40 Above the line : 6 + 32 + 58 = 96 Below the line : 18 + 47 + 74 = 139 T f (t ) sin(3 ⋅ ω0 ⋅ t )dt = [96 − 139] ⋅ [0.00125] = −0.0538 0 b3 = => 2 ⋅ (−0.0538) = −1.07 T So we get the same value of b3 as we expect to about 1% Method 3 Algebraically : solve the integral definite integral analytically. 2 b3 = T T 0 T A⋅t 2A sin(3ω0t )dt = t ⋅ sin(3ω0t )dt 2 T T 0 Now solve the integral part of the function. Reminder: Integration by parts uses the identity udv =uv − vdu u du du =1 dt u=t v dv cos(3ω0t ) v=− 3ω0 dv = sin(3ω0t ) dt T T T cos(3ω0t ) cos(3ω0t ) t ⋅ sin(3ω0t )dt = − t − − dt 3ω0 3ω0 0 0 0 T cos(3ω0T ) cos(3ω0t ) = − T −0 + dt 3ω0 3ω0 0 T sin(3ω0t ) T + 3ω0 9ω0 2 0 T =− + [0 − 0] 3ω0 =− Remember ω0 = 2π and sin(n2π) = 0 T So the putting the solution to the integral into the equation for b3: b3 = 2A T T2 0 2A t ⋅ sin(3ω0t ) dt = T2 −T 2A =− 3ω0T 3ω0 When A = 10, T = 0.1 s so ω0 = 2π / 0.1 = 20π : b3 = − 20 = −1.06 3 × 20π × 0.1 So b3 is −1.06 from the analytic equation (exact) which matches the predictions from the two approximations above. Mathcad demonstration of the formula f0 10 Hz Fundamental frequency Period in seconds = T 1 f0 Define the amplitude of the periodic function. A 10 Function f( t ) A. t T Note when t = 0 , f(t)=0 and when t = T, f(t) = A Now use the formulae to find the coefficients in the Fourier Series Find the constant term: a0 2. T T f( t ) dt 0 Calculated value of a0 = 10 Set the number of coefficients, n ( should really be infinite! ) nmax = 10 Find the n coefficients for cosine terms an 2. T T 0 f( t ) . cos n . ω 0 . t dt Find the n coefficients for sine terms bn 2. T T 0 f( t ) . sin n . ω 0 . t dt n 1 2 3 4 5 6 7 8 9 10 an bn 3.309. 10 12 4.388. 10 12 3.307. 10 12 4.663. 10 12 3.31. 10 12 4.39. 10 12 3.304. 10 12 4.82. 10 12 3.312. 10 12 4.39. 10 12 3.183 1.592 1.061 0.796 0.637 0.531 0.455 0.398 0.354 0.318 Define the Fourier Series a0 g( t ) an. cos n . ω 0 . t 2 bn. sin n . ω 0 . t n n Compare the Fourier series g(t) with n terms to the original function f(t) over two periods 10 g( t ) f( t ) 5 0 0 t Note this is an ODD function about the MEAN value, hence only sine terms appear in Fourier expansion Also note original function f(t) is only valid between 0 at T (blue dotted curve). This is OK as we only considered that repeat of the function. Note it is normal to plot the magnitude of the Fourier Coefficients in a bar chart, for example for the saw tooth above: 4 4 b 2 n 0 0 0 0 5 10 15 20 25 n 30 30 This emphasises that the sign of the terms depends on the phase of the wave being decomposed into its Fourier Components and that an and bn have discrete values for each integer value of n (they are not continuous functions) More comments on Fourier Analysis 1. We have confirmed that the first term in the Fourier series (a0/2) is the mean value of the function f(t) over one period: a0 1 = 2 T T f (t )dt = 0 Area under curve T e.g. for a sawtooth wave: 1 TA a0 A = 2 = = Mean value 2 T 2 A Area 0 0 T 2. We have considered waves that are periodic in time [f(t)=f(t+nT)]. Structures that are periodic in space obey the same maths. For example a diffraction grating is a regular series of slits. To do this: Replace ω0t by k0 x k0 = Where 2π λ0 and λ0 is the spatial period of the structure in meters. λ0 x The rest of the maths is the same: a0 ∞ + bn sin( nk0 x) f ( x) = 2 n =1 and bn = 2 λ0 λ0 f ( x) sin( nk0 x)dx 0 [Choose x = 0 point to have only sine terms] 3. Sometimes it is useful to do the integration over an interval –T/2 to +T/2 rather than 0 to T 4. If the function is complicated the integration might be easier if split into many parts: T e.g. dt = 0 TA T 0 TA dt + dt 5. A negative value for a coefficient simply means the phase of the wave is changed by π . e.g. − bn sin( nω0t ) = +bn sin( nω0t + π ) Also the energy carried by the wave depends on the value of bn 2 the sign of the coefficients is of no real interest. A graph of the energy density verse frequency is called the power spectrum. Fourier analysis of real waveforms Most real problems, like the example of the white dwarf, have a series of measurements not a function. The method of finding coefficients by numerical integration works but is very slow, especially for high frequency terms. There is a clever technique called the Fast Fourier Transform (FFT) that reduces the time required dramatically. Implementations of the FFT exist in many computer programs: for example in Mathcad, even in Excel! It can be thousands of times quicker for large data sets It works by accepting regularly spaced discrete data points, these can be calculated from a continuous function if required. Technical note: The FFT algorithm requires that there must be exactly 2n data points (n is an integer) e.g.: 256, 512, 1024 etc. Mathcad example of FFT Remember there must be 2n points: i 0 .. 255 Use these to count across 2π, ie one cycle: φi 2. π. i 255 Function (two “real terms” + noise): Fi sin 7 . φi cos 3 . φi FFT 0 1 2 F= 3 4 5 6 7 8 0 1.029 1.108 1.171 1.353 1.74 1.684 1.806 1.871 1.993 0.2 . ( rnd( 2 ) 1) fft ( F ) 0 0 1 2 FFT = 3 4 5 6 7 8 0.204 0.093+0.159i 0.052-0.092i 8.053-0.234i -0.02+0.186i -0.137+0.247i -0.031+0.37i 0.713+7.937i -0.115-0.226i NOTE: Only the first 8 terms of the data (F) and Fourier transformed data (FFT) are shown. There are 256 data points and 128 FFT point in total. The real parts of FFT correspond to sine terms in F, imaginary to cosine terms. Plot of data: 2 1 F 0 i 1 2 0 50 100 150 200 250 i Plot of power spectrum of the above data j 0 .. 128 100 10 FFT j 2 1 0.1 0.01 3 1 10 0 20 40 60 80 j See peaks only at 3 and 7 as expected Note: log y scale!. 100 120
© Copyright 2024