Find the compact trigonometric Fourier series for the period
Solution
ECE 3640 Lecture 4 – Fourier series: expansions of periodic functions. Objective: To build upon the ideas from the previous lecture to learn about Fourier series, which are series representations of periodic functions. Periodic signals and representations From the last lecture we learned how functions can be represented as a series of other functions: f(t) = Xn k=1 ckik(t). We discussed how certain classes of things can be built using certain kinds of basis functions. In this lecture we will consider specifically functions that are periodic, and basic functions which are trigonometric. Then the series is said to be a Fourier series. A signal f(t) is said to be periodic with period T0 if f(t) = f(t + T0) for all t. Diagram on board. Note that this must be an everlasting signal. Also note that, if we know one period of the signal we can find the rest of it by periodic extension. The integral over a single period of the function is denoted by Z T0 f(t)dt. When integrating over one period of a periodic function, it does not matter when we start. Usually it is convenient to start at the beginning of a period. The building block functions that can be used to build up periodic functions are themselves periodic: we will use the set of sinusoids. If the period of f(t) is T0, let 0 = 2/T0. The frequency 0 is said to be the fundamental frequency; the fundamental frequency is related to the period of the function. Furthermore, let F0 = 1/T0. We will represent the function f(t) using the set of sinusoids i0(t) = cos(0t) = 1 i1(t) = cos(0t + 1) i2(t) = cos(20t + 2) . . . Then, f(t) = C0 + X n=1 Cn cos(n0t + n) The frequency n0 is said to be the nth harmonic of 0. Note that for each basis function associated with f(t) there are actually two parameters: the amplitude Cn and the phase n. It will often turn out to be more useful to represent the function using both sines and cosines. Note that we can write Cn cos(n0t + n) = Cn cos(n) cos(n0t) Cn sin(n)sin(n0t). ECE 3640: Lecture 4 – Fourier series: expansions of periodic functions. 2 Now let an = Cn cos n bn = Cn sin n Then Cn cos(n0t + n) = an cos(n0t) + bn sin(n0t) Then the series representation can be f(t) = C0 + X n=1 Cn cos(n0t + n) = a0 + X n=1 an cos(n0t) + bn sin(n0t) The first of these is the compact trigonometric Fourier series. The second is the trigonometric Fourier series.. To go from one to the other use C0 = a0 Cn = p a 2 n + b 2 n n = tan1 (bn/an). To complete the representation we must be able to compute the coefficients. But this is the same sort of thing we did before. If we can show that the set of functions {cos(n0t),sin(n0t)} is in fact an orthogonal set, then we can use the same formulas we did before. Check: Z T0 cos(n0t) cos(m0t) dt = 0 n 6= m T0 2 n = m 6= 0 So pairs of cosine functions are orthogonal. Similarly, Z T0 sin(n0t)sin(m0t) dt = 0 n 6= m T0 2 n = m 6= 0 So pairs of sin functions are orthogonal. Also, Z T0 sin(n0t) cos(m0t) dt = 0 for all n and m. So the sines and cosines are orthogonal to each other. This means that we can use our formulas: an = hf(t), cos(n0t)i h cos(n0t), cos(n0t)i = 2 T0 Z T0 f(t) cos(n0t) dt bn = hf(t),sin(n0t)i hsin(n0t),sin(n0t)i = 2 T0 Z T0 f(t)sin(n0t) dt The only exception is the coefficient a0: a0 = hf(t), 1i h1, 1i = 1 T0 Z T0 f(t) dt Example 1 Let us start with a square wave: ECE 3640: Lecture 4 – Fourier series: expansions of periodic functions. 3 f(t) = 1 /2 < t < /2 0 t [, /2),(, 2, ] and its periodic extension. The period is T0 = 2, so 0 = 2/T0 = 1. The series is f(t) = a0 + X n=1 an cos nt + bn sin nt The coefficients can be found as follows: a0 = 1 2 Z /2 /2 dt = 1 2 an = 1 Z /2 /2 cos nt dt = 2 n sin(n/2) = 0 n even 2 n n = 1, 5, 9, 13, . . . 2 n n = 3, 7, 11, 15, . . . bn = 1 Z /2 /2 sin nt dt = 0. We can write f(t) = 1 2 + 2 cost 1 3 cos 3t + 1 5 cos 5t 1 7 cos 7t + · · · . Here is an interesting tidbit: Evaluate this at t = 0: 1 = 1 2 + 2 1 1 3 + 1 5 1 7 + · · · . Solving, we get = 4 1 1 3 + 1 5 1 7 + · · · . In the compact form, C0 = 1 2 Cn = 0 n even 2 n n odd n = n = 3, 7, 11, 15, . . ., 0 otherwise It is interesting to see how the function gets built up at the pieces are added ECE 3640: Lecture 4 – Fourier series: expansions of periodic functions. 4 together: The Fourier Spectrum For a function f(t) having a compact trigonometric Fourier series, the set of amplitudes {Cn} and the set of phases {n} provide all the information necessary to represent the function. (This is interesting, if you think about it: a function which is defined at every point in a continuum can be represented with only a countable number of points.) A plot of the amplitudes {Cn} vs. the is the amplitude spectrum of the signal. A plot of the phase {n} vs. is the phase spectrum of the signal. Example 2 Show the magnitude and phase spectrum of the square wave from the previous example. Actually, if we allow the amplitude to show a shift of by allowing a signed ECE 3640: Lecture 4 – Fourier series: expansions of periodic functions. 5 quantity, then the task is somewhat easier: In this case the spectrum is said to be an amplitude spectrum, rather than a magnitude spectrum. The amplitude spectrum is convenient to work with whenever all the sine terms are zero, so all the information is conveyed in the {an}. Example 3 Find the Fourier series of the following signal, and plot its magnitude and phase spectrum. The signal is periodic with T0 = 2. The fundamental frequency is 0 = 2 2 = . The function can be written analytically (for the purposes of integration) as f(t) = 2At 1 2 t 1 2 2A(1 t) 1 2 t 3 2 This gives is only one period of the function, but that is sufficient for our purposes. The Fourier series coefficients can be written as an = 2 T0 Z 3/2 1/2 f(t) cos ntdt = Z 1/2 1/2 2At cos ntdt + Z 3/2 1/2 2A(1 t) cos ntdt = 0 (We will take this at face value for now. Soon we will learn some tricks that will help evaluate this sort of thing sometimes. But notice the utility of being able to use a symbolic integration package. You may want to go back and review ECE 3640: Lecture 4 – Fourier series: expansions of periodic functions. 6 what we did early last quarter with Matlab: the symbolic integration exercises were written with this sort of integration mind!) bn = 2 T0 Z 3/2 1/2 f(t)sin ntdt = Z 1/2 1/2 2Atsin ntdt + Z 3/2 1/2 2A(1 t)sin ntdt = 8A n2 2 sin(n/2) Actually, I checked this using my current favorite symbolic tool, Mathematica. This is the result: In[6] := bn = Integrate[2 A t Sin[n Pi t],{t,-1/2,1/2}] + Integrate[2 A (1-t) Sin[n Pi t],{t,1/2,3/2}] n Pi n Pi A (n Pi Cos[----] - 2 Sin[----]) 2 2 Out[6]= -(--------------------------------) + 2 2 n Pi n Pi n Pi A (n Pi Cos[----] + 2 Sin[----]) 2 2 > -------------------------------- + 2 2 n Pi n Pi -(A n Pi Cos[----]) 2 n Pi 2 (------------------- + A Sin[----]) 2 2 > ------------------------------------- + 2 2 n Pi 3 n Pi 3 n Pi A (n Pi Cos[------] - 2 Sin[------]) 2 2 > ------------------------------------ 2 2 n Pi In[7]:= Simplify[bn] n Pi n Pi n Pi 2 -4 A (n Pi Cos[----] - 2 Sin[----]) Sin[----] 2 2 2 Out[7]= ---------------------------------------------- 2 2 ECE 3640: Lecture 4 – Fourier series: expansions of periodic functions. 7 n Pi In problems of this sort, it is considered bad form to leave it in terms of all the sins and cosines (go thy way and sin no more!), since they can occlude the underlying values of the coefficients. So we will work through the detail to get the answer shown in the book. In doing this, however, do not lose sight of the forest for the trees. We already have the coefficients; we are simply manipulating them a bit. In practice, these types of manipulations could be skipped or be done by a computer (say, if we were plotting the magnitude spectrum). In the simplification, note that the term sin2 (n/2) is zero when n is even. So we only need to consider odd n. For odd n, sin2 (n/2) = 1, so we can focus on the other part. First, consider odd n of the form n = 4k + 1. Then cos(n/2) = cos((4k + 1)/2) = cos(/2) = 0 and sin(n/2) = sin((4k + 1)/2) = sin(/2) = 1 sin(3n/2) = sin(3(4k + 1)/2) = sin(3/2) = 1 When n = 4k + 3, cos(n/2) = cos((4k + 3)/2) = cos(3/2) = 0 sin(n/2) = sin((4k + 3)/2) = sin(3/2) = 1 sin(3n/2) = sin(3(4k + 3)/2) = sin(9/2) = 1 Combining all this together gives the desired answer. Using the symbolic toolbox in Matlab, I obtained syms A n t int(’2*A*t*sin(n*pi*t)’,t,-1/2,1/2) ans = -2*A*(-2*sin(1/2*n*pi)+n*pi*cos(1/2*n*pi))/n^2/pi^2 The Fourier series is f(t) = X n bn sin(nt) = 8A 2 X n=1,3,5,... (1)(n1)/2 n2 sin(nt) = 8A 2 X n=1,3,5,... sin(n/2) n2 sin(nt) = 8A 2 sin(t) 1 9 sin(3t) + 1 25 sin(5t) 1 49 sin(7t) + · · · To plot the Fourier spectrum the compact trigonometric Fourier series is needed. Recall that this expresses the function in terms of cosines. We only have it in terms of sines. We we have to do a little phase-shift trick: sin(kt) = cos(kt 90 ) sin(kt) = cos(kt + 90 )

