Signals&Systems Laboratory IFE 2010/201 1 Experiment 3. Fourier Series. Signal expansion and synthesis. Introduction 1.1. Fourier series. Consider a periodic signal x(t) with period T. If some conditions (see Dirichlet conditions from lecture book) are satisfied, the function (signal) x(t) can be expressed as series: xt a0 an cosn0t bn sin n0t (1) n 1 2 2f 0 . T Coefficients of the trigonometric Fourier series may be calculated from the following relations: where 0 1T 1 t T a0 f t dt f t dt T0 T t 0 (2) 0 2T 2 t T am f t cos m0tdt f t cos m0tdt T0 T t m 1, 2,... (3) 2T 2 t T bm f t sin m0tdt f t sin m0tdt T0 T t m 1, 2,... (4) 0 0 0 0 where t0 is any Real number. Formula (1) can be also expressed in more convenient equivalent form: f t A0 An cosn0t n (5) n1 Cosine terms in (1) and (5) are called harmonic (n-th harmonic has amplitude An , phase n and angular frequency n 0 , constant term A0 a0 (2) is the 0-th harmonic. First harmonic: y1 t a1 cos 0t b1 sin 0t A1 cos 0t 1 (6) is called usually basic harmonic with angular (basic) frequency 0 2f 0 . The plot of amplitude An i terms of n is called amplitude spectrum and plot of phase as a function of n is called phase spectrum. Amplitudes and phases may be calculated from the relations: Zakład Elektrotechniki Teoretycznej PŁ copyrights mhonwia Signals&Systems Laboratory IFE 2010/201 2 An an2 bn2 (7) bn (8) an The periodic signals are often presented in more compact form called exponential Fourier series: n arctan xt c~ e n jn0t (9) n where 1 t T c~n xt e jn t dt n 1, 2, ... . T t Relations between different Fourier series forms are specified as follows: 0 0 (10) 0 1 t T c~0 f t dt a0 A0 . T t 0 (11) 0 b 1 2 1 c~n an bn2 An , n arg c~n a tan n 2 2 an n 1,2,3.... Similarly, the plot of c~n versus n is called the amplitude spectrum and the plot of n arg c~n versus n is called phase spectrum. Note, that following relationships are valid: c~n c~n , n n n 1,2,3.... 1.2. How to compute coefficients. The amplitude and phase spectra, based on form (5) or (10) can be computed by use of Matlab integration formulas like: quadl numerically evaluate integral, adaptive Lobatto quadrature syntax q= quadl (fun,a,b) approximates the integral of function fun from a to b, to within an error of 10E-6 uunction handesing recursive adaptive Lobatto quadrature, fun is a function handle. More often, Fourier series computations are performed numerically using the Discrete Fourier Transform (DFT), which in turn is implemented numerically using an efficient algorithm known as the Fast Fourier Transform (FFT). Assuming, that sampling frequency used for discretization of the periodic function interval is equal to fs (samples per second) and applied DFT transform has N-elements, basic harmonic of the Fourier series may be calculated from he formula: Zakład Elektrotechniki Teoretycznej PŁ copyrights mhonwia Signals&Systems Laboratory IFE 2010/201 fo 3 fs N . (12) Frequence of the next stripes of Fourier series spectrum ae of the form: . fi if s N (13) Constant term and amplitudes of the harmonice (up to i=N/2) of the Fourier series having form(5) follows the relations: Ai 2 Xi N , i 1,2,..., N 2 2 j N mn X n xm w , n 0,1,2,..., , w e N 2 m 0 N 1 (14) Phases o harmonic are computed from the arguments f Xn. As an illustration, the following code shows how to use fft approach to obtain Fourier expansion coefficients. You can study this code and further enhance it to complet yoyr work. Useful Matlab functions: fft(x,N), length(), abs, angle, stem figure, xlabel, ylabel, title. Numerical calculations may be perfored also by Simulink models (available only in Matlab 5.3 instalation). Exelary scheme is shown in Fig.1 Zakład Elektrotechniki Teoretycznej PŁ copyrights mhonwia Signals&Systems Laboratory IFE 2010/201 Fig.1. FFT based algorithm for finding harmonic’s coefficients – Simulink implemetation. Fig.3.Block parameters.. Zakład Elektrotechniki Teoretycznej PŁ copyrights mhonwia 4 Signals&Systems Laboratory IFE 2010/201 5 2. Laboratory work 2.1. PART A 2.1.1. In Matlab (5.3) go to the command window and run one of the dlivered demo m-files pointed by your teacher. This will bring up a Graphical User Inerface (GUI) that can be used to test and demonstrate many concepts and properties of the Fourier series expansion. 2.1.2. Try different types of function. Explain why some signals require many more harmonics than others in order to get match between the Fourier approximation and original signal? 2.1.3. Consider the plots of amplitude and phase spectra. Describe how the symmetry of signal affect the spectrum. 2.1.4. Observe the Gibbs phenomena. Briefly explain. 2.2. PART B 2.2.1. Consider the periodic signals given by the teacher (see Fig.2,3,4). Find and plot amplitude and phase spectra. Use your m–file based on integration formulas or FFT concept. Tabulate results. REMARKS: For the expansion of the given signal x(t), the number f harmonics should be >=8. Observe, what happened, if the sampling period Ts is not an integer multiplicity of the signal period T. Your report should contain plot of the investigated functions, amplitude and phase spectra, TABLES with coefficients, conclusions. 2.2.2. Write your own m-script enabling to built up periodic signals from its harmonics. Attach some examples based on coefficients calculated before. TABLE Name of example (type of signal) Method Coeff. Analitcal solution (book) A0 A1 Q1 A2 Q2 A3 Q3 A4 Q4 A5 Q5 Zakład Elektrotechniki Teoretycznej PŁ copyrights mhonwia Integration based algorithm FFT based algorithm Signals&Systems Laboratory IFE 2010/201 6 fT(t) A T a 0 B Fig.2 gT(t) A T 0 a b c B Fig.3 Zakład Elektrotechniki Teoretycznej PŁ copyrights mhonwia d e Signals&Systems Laboratory IFE 2010/201 7 f 1 (t) 2 1 0 T T/2 T/4 -2 f 2 (t) 2 1 0 T/4 T/2 T t f 3 (t) 2 1 0 T/4 T T/2 -2 Fig.4 Zakład Elektrotechniki Teoretycznej PŁ copyrights mhonwia t