Vous êtes sur la page 1sur 3

Signals and Systems I (2016506)

Faculty of Engineering
Department of Electrical and Electronics Engineering

Lecture 5 - Fourier Series


Prelude: Fourier Series (FS) allows us to represent a periodic signal of interest as an infinite
linear combination of pure sinusoids. The frequencies of such sinusoids are integer multiples
of a fundamental frequency ω0 .
There are multiple algorithms to evaluate numerically the FS of a periodic signal in Scilab
(or other languages). We will introduce a simple one (perhaps, the simplest). Assume a time
interval ∆t. An approximation of the DC component can be written as

1 1
Z

T <∑
c0 = x (t) dt ≈ ∆t x (t) (1)
T <T > T>

In other words, we “extract” the differential dt as a constant from the integral, divide it by
the fundamental period, and multiply this result by the sum of all values within the vector
x, containing the information of a period of the signal x (t). A similar approximation can
be made for the Exponential Fourier Series coefficients. Recall that these coefficients can be
computed via the analysis equation by

1 1
Z

T <∑
c̄k = x (t) e− jkω0 t dt ≈ ∆t x (t) e− jkω0 t (2)
T <T > T>

In this case, the inner summation ∑<T > x (t) e− jkω0 t must be evaluated for each value of k of
interest. For example, if we are interested in computing the coefficient c̄3 (k = 3), then we
have to calculate the sum
1
T <∑
∆t x (t) e− j3ω0 t
T>

for loops can be useful when multiple harmonics are requested. The following piece of code
illustrates this procedure for computing 3 harmonics. Notice that we assume that the signal
x (t) has already been computed within the program, and its fundamental period T0 has been
declared.
1 // DC level
2 c0 =(1/ T0 ) * sum ( x ) * dt ;
3 // Vector for the FS coefficients with positive frequencies
4 c = zeros (1 ,3) ;
5 // Vector for the FS coefficients with negative frequencies
6 c_m =0* c ;
7
8 // Computes the harmonic contents of the signal up to the third harmonic
9 for k =1:3
10 // Positive frequency coefficients
11 c ( k ) =(1/ T0 ) * dt * sum ( x .* exp ( - %i * k *2* %pi * t / T0 ) ) ;
12 // Negative frequency coefficients
13 c_m ( k ) =(1/ T0 ) * dt * sum ( x .* exp ( %i * k *2* %pi * t / T0 ) ) ;
14 end

1. Consider the following periodic signal:


(
T0
sin (ω0 t) 0≤t< 2
x (t) = T0
0 2 ≤t


with ω0 = T0 = 2π f 0 . Assume f 0 = 60 Hz
a) Plot the signal x (t) for 10 periods. Use a time interval of ∆t = 1001 f (Hint: con-
0
struct a plot with three subplots. The two remaining spaces will be used in part e)
of this exercise)
b) Compute the DC level of the signal (Hint: since the signal is constructed in ten
periods, divide the approximation of the integral by ten to obtain the exact result)
c) Determine the value of the following Exponential Fourier Series (EFS) coeffi-
cients and fill the table:
k c̄k
-3
-2
-1
0
1
2
3
d) Repeat the previous exercise for f 0 = 120 Hz. Compare your results and conclude.
k c̄k
-3
-2
-1
0
1
2
3
e) In the second and third subplots, graph the magnitude and the phase of the first
5 EFS harmonics (both positive and negative: −5 ≤ n ≤ 5), respectively. How can
you describe the magnitude and phase spectra?
2. Consider the same signal as in Exercise 1. Assume f 0 = 60 Hz. It is recommended to
develop this second exercise in a new .sce file
a) Complete the following code. By doing so, you obtain a function that computes
the DC component, M positive- and M negative-frequency EFS coefficients. Us-
ing the synthesis equation, the function reconstructs the original periodic signal
employing the DC component, M positive and M negative harmonics. The code
understands that we want to plot the signal for T periods. So, as in the previous
exercise, let T= 10.
1 function x_approx = F o u r i e r S e r i e s S y n t h e s i s (x , f0 ,t , dt ,T , M )
2 // DC component
3 c0 = f0 * sum ( x ) * dt / T ;
4 // Analysis equation for the coefficients of Fourier Series
5 for k =1: M
6 // Complete the following lines
7 // Positive frequency coefficients
8 // c ( k ) = (...) ;
9 // Negative frequency coefficients
10 // c_m ( k ) = (...) ;
11 end
12 // Synthesis equation
13 x_approx = c0 ;
14 for k =1: M
15 // Complete the following line
16 // x_approx = x_approx + (...) ;
17 end
18 endfunction

b) Using the FourierSeriesSynthesis function, compute a Fourier Series approxi-


mation for the signal x (t) using 1, 2, 5 and 15 harmonics
c) Compute the approximation error for each Fourier Series approximation. Let the
approximation error be
e (t) = x (t) − x̃ (t) (3)

d) Plot the original signal and each of its Fourier Series approximations alongside
with the approximation error. Superimpose the plots of the original signal and its
approximation. (Hint: generate a 2 × 2 subplot –e.g., subplot(2,2,1)- and graph
the approximation error below the superimposed graph of the signal x (t) and its
approximation x̃ (t). Open two figures in order to have better insight of the graphs)

Vous aimerez peut-être aussi