Section 6: Summary Section 7 a n = 2 ( 2πnx cos b n = 2 ( 2πnx sin d = f(x dx f(x = d + n= [ a n cos f(x dx f(x dx ( ( ] 2πnx 2πnx + b n sin You can sometimes combine multiple integrals using symmetry properties. Sometimes it is faster to calculate a related Fourier series of delta functions and integrate. Don t forget the Fourier serieses given in the maths data book. 93 Convergence & Half Range Serieses he rule for predicting the convergence of the Fourier series from the shape of the function is introduced. his is used with the Fourier series for general period to calculate serieses, valid over limited ranges, with improved convergence properties. Four different serieses are calculated to model the same simple function in order to illustrate this. he usefulness of Matlab and Octave for numerical calculation, and the use of Matlab for symbolic algebra are introduced. 94
General Range Example 3 A even function f(t is periodic with period = 2, and f(t = cosh(t for t. Sketch f(t in the range 2 t 4. Find a Fourier series representation for f(t. First remember what the graph of cosh(t looks like. f(t 2 2 3 4 It is an even function b n = and a n. he t cosh(t t mean value of the function is non-zero d. a n = 2 ( 2πnt f(tcos dt = 4 ( 2πnt f(tcos dt = 2 cosh(t cos(nπt dt = 2sinh( + n 2 π 2 95 96
Square Wave Series Convergence d = f(t dt = 2 f(t dt = cosh(t dt = sinh( he graphs below show the sum of, 2, 3... up to 9 terms of the Fourier series for a square wave. - - - So -5 5-5 5-5 5 ( 2πnx f(t = d + a n cos n= cos(nπt = sinh( + 2 + n 2 π 2 n= - -5 5 - -5 5 - -5 5 - - - -5 5-5 5-5 5 97 98
Using Matlab/Octave % Fourier series for square wave number = 2; dtheta = 4*pi/number; theta = -2*pi:dtheta:2*pi; nharm = 2; d = ; thing = d * ones(,number+; for n=:nharm if mod(n,2 == bn = 4/(pi*n; else bn = ; end an = ; thing = thing + an * cos(n*theta... + bn * sin(n*theta; plot(theta,thing; axis([-2*pi 2*pi -.5.5]; pause( end theta = -2*pi:dtheta:2*pi; sets up theta as an array with 2 elements, starting at 2π, going up to 2π, with spacing dtheta= 4π/2. 6.2832, 6.224,......6.224,6.2832 thing = d * ones(,number+; initialises the 2 element array in which we hold the value of the series at each angle. he initial value of each element is d, which in this case is zero. for n=:nharm his introduces a for loop. We go round the loop nharm times to add in nharm harmonics. thing = thing + an * cos(n*theta... + bn * sin(n*theta; his statement works on every element of the theta array, calculating the terms of the cos and sin serieses and adding them in to the appropriate sums in the thing array. 99
Using Matlab Symbolic ools Both convolution and Fourier work involves a lot of integration. Sometimes it is nice to know what the right answer is, so you can check your working. o integrate p with respect to x from a to b you use the command int(p, x, a, b. Consider the integral: 2 ( 2πnx cos x dx = >> syms n x >> int((2/*x*cos(2*pi*n*x/,x,, ans = *(cos(pi*nˆ2- +2*pi*n*sin(pi*n*cos(pi*n/piˆ2/nˆ2 which is ( (cos(π n 2 + 2 π nsin(π ncos(π n π 2 n 2 But as n is an integer, cos 2 (nπ = and sin(nπ =, so the integral evaluates to zero. Don t rely on this too much. You need to be able to integrate efficiently by hand in the exam. Convergence Examples he Fourier series for a square wave converges as /n. Notice that it is discontinuous of value. f(t = 4 π [ 2π sin(t + sin(3t 3 he Fourier series for a triangular wave converges as /n 2. It is continuous of value, but discontinuous of gradient. F(t = 4 π [ cos(t + cos(3t 9 π f(t + sin(5t 5 π π 2 F(t + cos(5t 25 π +... π t 2π ] +... 2 ] t
Odd Numbers Convergence If m =,2,3,4,5,6,7... Integrate Series for delta functions does not converge and n = 2m and m = n + 2 then n =,3,5,7,9,,3... value: converges as /n Odd Functions Differentiate gradient: converges as /n 2 second derivative: converges as /n 3 f(x = f( x 3 4
Half Range Series If we want to model a signal f(x = x in the range to. We can use the Fourier formulae for general range to generate a variety of different serieses. hey will all be the same in the range to, but some may converge faster than others. 2 2 Full range series period converges as /n Cosine series period 2, b n= converges as /n 2 Sine series period 4, a n=, d = converges as /n 2 Sine series period 2, a n=, d = converges as /n Normal Series, Period Find the Fourier series to model f(x = x from to, using a series of period. a n = 2 ( 2πnx cos b n = 2 ( 2πnx sin d = f(x = 2 x dx = 2 n= f(x 2 2 nπ sin x dx = x dx = nπ ( 2πnx Notice that the series converges as /n. x 5 6
Cosine Series, Period 2 Find the Fourier series to model f(x = x from to, using a cosine series of period 2. a n = = = 2 d = 2 ( πnx cos f(x dx [ cos ( πnx ( πnx cos f(x = 2 f(x dx = 2 m= f(x 2 2 ( x dx + cos ( ] πnx x dx x dx = 4 n 2, only n ODD π2 4 (2m 2 π 2 cos Notice that the series converges as /n 2. ( (2m πx 7 x Sine Series, Period 4 Find the Fourier series to model f(x = x from to, using a sine series of period 4. f(x 2 2 Notice how the function is symmetrical about (i.e. 4 of the period. his leads to b n = when n is even because all such terms are anti-symmetric about. b n = 2 f(x = = 2 2 sin ( πnx 2 ( πnx sin 2 = 8( n 2 π 2 m= ( n+3 2 f(x dx x dx, n odd only, n odd only 8( (m+ (2m 2 π 2 sin Notice that the series converges as /n 2. ( π(2m x 2 8 x
Section 7: Summary Sine Series, Period 2 Find the Fourier series to model f(x = x from to, using a sine series of period 2. b n = f(x = f(x 2 2 ( πnx sin = 2 nπ ( n n= x dx 2 nπ ( n sin ( πnx x Integrate Differentiate Series for delta functions does not converge value: converges as /n gradient: converges as /n 2 second derivative: converges as /n 3 Notice that the series converges as /n. If you are modelling a limited section of a function, pick the Fourier series period so as to get good convergence and a series that is easy to calculate (i.e. some of a n, b n or d zero. 9