Attia, John Okyere. “Fourier Analysis.” Electronics and Circuit Analysis using MATLAB. Ed. John Okyere Attia Boca Raton: CRC Press LLC, 1999 © 1999 by CRC PRESS LLC CHAPTER EIGHT FOURIER ANALYSIS In this chapter, Fourier analysis will be discussed. Topics covered are Fou- rier series expansion, Fourier transform, discrete Fourier transform, and fast Fourier transform. Some applications of Fourier analysis, using MATLAB, will also be discussed. 8.1 FOURIER SERIES If a function g t ( ) is periodic with period T p , i.e., g t g t T p ( ) ( ) = ± (8.1) and in any finite interval g t ( ) has at most a finite number of discontinuities and a finite number of maxima and minima (Dirichlets conditions), and in addition, g t dt T p ( ) < ∞ ∫ 0 (8.2) then g t ( ) can be expressed with series of sinusoids. That is, g t a anw t b nw t n n n ( ) cos( ) sin( ) = + + = ∞ ∑ 0 0 0 1 2 (8.3) where w T p 0 2 = π (8.4) and the Fourier coefficients a n and b n are determined by the following equa- tions. a T g t nw t dt n p t t T o o p = + ∫ 2 0 ( ) cos( ) n = 0, 1,2, … (8.5) © 1999 CRC Press LLC© 1999 CRC Press LLC b T g t nw t dt n p t t T o o p = + ∫ 2 0 ( ) sin( ) n = 0, 1, 2 … (8.6) Equation (8.3) is called the trigonometric Fourier series. The term a 0 2 in Equation (8.3) is the dc component of the series and is the average value of g t ( ) over a period. The term anw t b nw t n n cos( ) sin( ) 0 0 + is called the n - th harmonic. The first harmonic is obtained when n = 1. The latter is also called the fundamental with the fundamental frequency of ω o . When n = 2, we have the second harmonic and so on. Equation (8.3) can be rewritten as g t a Anw t n n n ( ) cos( ) = + + = ∞ ∑ 0 0 1 2 Θ (8.7) where A a b n n n = + 2 2 (8.8) and Θ n n n b a = − − tan 1 (8.9) The total power in g t ( ) is given by the Parseval’s equation: P T g t dt A A p t t T dc n n o o p = = + + = ∞ ∫ ∑ 1 2 2 2 2 1 ( ) (8.10) where A a dc 2 0 2 2 = (8.11) The following example shows the synthesis of a square wave using Fourier series expansion. © 1999 CRC Press LLC© 1999 CRC Press LLC Example 8.1 Using Fourier series expansion, a square wave with a period of 2 ms, peak-to- peak value of 2 volts and average value of zero volt can be expressed as g t n n f t n ( ) ( ) sin[( ) ] = − − = ∞ ∑ 4 1 2 1 2 1 2 0 1 π π (8.12) where f 0 500 = Hz if a t ( ) is given as a t n n f t n ( ) ( ) sin[( ) ] = − − = ∑ 4 1 2 1 2 1 2 0 1 12 π π (8.13) Write a MATLAB program to plot a t ( ) from 0 to 4 ms at intervals of 0.05 ms and to show that a t ( ) is a good approximation of g(t ). Solution MATLAB Script % fourier series expansion f = 500; c = 4/pi; dt = 5.0e-05; tpts = (4.0e-3/5.0e-5) + 1; for n = 1: 12 for m = 1: tpts s1(n,m) = (4/pi)*(1/(2*n - 1))*sin((2*n - 1)*2*pi*f*dt*(m-1)); end end for m = 1:tpts a1 = s1(:,m); a2(m) = sum(a1); end f1 = a2'; t = 0.0:5.0e-5:4.0e-3; clg plot(t,f1) xlabel('Time, s') © 1999 CRC Press LLC© 1999 CRC Press LLC ylabel('Amplitude, V') title('Fourier series expansion') Figure 8.1 shows the plot of a t ( ) . Figure 8.1 Approximation to Square Wave By using the Euler’s identity, the cosine and sine functions of Equation (8.3) can be replaced by exponential equivalents, yielding the expression g t c jnw t n n ( ) exp( ) = =−∞ ∞ ∑ 0 (8.14) where c T g t jnw t dt n p t T p p = − − ∫ 1 2 2 0 ( ) exp( ) / / (8.15) and w T p 0 2 = π © 1999 CRC Press LLC© 1999 CRC Press LLC Equation (8.14) is termed the exponential Fourier series expansion. The coeffi- cient c n is related to the coefficients a n and b n of Equations (8.5) and (8.6) by the expression c a b b a n n n n n = + ∠ − − 1 2 2 2 1 tan ( ) (8.16) In addition, c n relates to A n and φ n of Equations (8.8) and (8.9) by the rela- tion c A n n n = ∠Θ 2 (8.17) The plot of c n versus frequency is termed the discrete amplitude spectrum or the line spectrum. It provides information on the amplitude spectral compo- nents of g t ( ). A similar plot of ∠c n versus frequency is called the dis- crete phase spectrum and the latter gives information on the phase components with respect to the frequency of g t ( ) . If an input signal x t n ( ) x t c jnw t n n o ( ) exp( ) = (8.18) passes through a system with transfer function H w ( ) , then the output of the system y t n ( ) is y t H jnw c jnw t n o n o ( ) ( ) exp( ) = (8.19) The block diagram of the input/output relation is shown in Figure 8.2. H(s)x n (t) y n (t) Figure 8.2 Input/Output Relationship However, with an input x t ( ) consisting of a linear combination of complex excitations, © 1999 CRC Press LLC© 1999 CRC Press LLC x t c jnw t n n n o ( ) exp( ) = =−∞ ∞ ∑ (8.20) the response at the output of the system is y t H jnw c jnw t n n o n o ( ) ( ) exp( ) = =−∞ ∞ ∑ (8.21) The following two examples show how to use MATLAB to obtain the coeffi- cients of Fourier series expansion. Example 8.2 Forthefull-wave rectifier waveform shown in Figure 8.3,theperiod is 0.0333s and the amplitude is 169.71 Volts. (a) Write a MATLAB program to obtain the exponential Fourier series coefficients c n for n = 0,1, 2, , 19 (b) Find the dc value. (c) Plot the amplitude and phase spectrum. Figure 8.3 Full-wave Rectifier Waveform © 1999 CRC Press LLC© 1999 CRC Press LLC Solution diary ex8_2.dat % generate the full-wave rectifier waveform f1 = 60; inv = 1/f1; inc = 1/(80*f1); tnum = 3*inv; t = 0:inc:tnum; g1 = 120*sqrt(2)*sin(2*pi*f1*t); g = abs(g1); N = length(g); % % obtain the exponential Fourier series coefficients num = 20; for i = 1:num for m = 1:N cint(m) = exp(-j*2*pi*(i-1)*m/N)*g(m); end c(i) = sum(cint)/N; end cmag = abs(c); cphase = angle(c); %print dc value disp('dc value of g(t)'); cmag(1) % plot the magnitude and phase spectrum f = (0:num-1)*60; subplot(121), stem(f(1:5),cmag(1:5)) title('Amplitude spectrum') xlabel('Frequency, Hz') subplot(122), stem(f(1:5),cphase(1:5)) title('Phase spectrum') xlabel('Frequency, Hz') diary dc value of g(t) ans = 107.5344 Figure 8.4 shows the magnitude and phase spectra of Figure 8.3. © 1999 CRC Press LLC© 1999 CRC Press LLC Figure 8.4 Magnitude and Phase Spectra of a Full-wave Rectification Waveform Example 8.3 The periodic signal shown in Figure 8.5 can be expressed as g t e t g t g t t ( ) ( ) ( ) = − ≤ < + = − 2 1 1 2 (i) Show that its exponential Fourier series expansion can be expressed as g t e e jn jn t n n ( ) ( ) ( ) ( ) exp( ) = − − + − =−∞ ∞ ∑ 1 2 2 2 2 π π (8.22) (ii) Using a MATLAB program, synthesize g t ( ) using 20 terms, i.e., © 1999 CRC Press LLC© 1999 CRC Press LLC g t e e jn jn t n n ( ) ( ) ( ) ( ) exp( ) ∧ − =− = − − + ∑ 1 2 2 2 2 10 10 π π 0 2 4 t(s) g(t) 1 Figure 8.5 Periodic Exponential Signal Solution (i) g t c jnw t n o n ( ) exp( ) = =−∞ ∞ ∑ where c T g t jnw t dt n p T T o p p = − − ∫ 1 2 2 ( ) exp( ) / / and w T o p = = = 2 2 2 π π π c t jn t dt n = − − − ∫ 1 2 2 1 1 exp( ) exp( ) π c e e jn n n = − − + − ( ) ( ) ( ) 1 2 2 2 2 π thus © 1999 CRC Press LLC© 1999 CRC Press LLC