258 C H A P T E R 4: Frequency Analysis: The Fourier Series
%%%%%%%%%%%%%%%%%
% Example 4.5---Fourier series of train of pulses
%%%%%%%%%%%%%%%%%
clear all;clf
syms t
T0 = 1; m = heaviside(t)−heaviside(t−T0/4) + heaviside(t− 3 ∗T0/4);x = 2∗m
[X,w] = fourierseries(x,T0,20);
subplot(221); ezplot(x,[0 T0]); grid
subplot(223); stem(w,abs(X))
subplot(224); stem(w,angle(X))
Notice that in this case:
- TheXkFourier coefficients of the train of pulses are given in terms of the sin(x)/xor the sinc
function. This function was presented in Chapter 1. Recall that the sinc is
n Even—that is, sin(x)/x=sin(−x)/(−x).
n The value atx=0 is found by means of L’Hopital’s rule because the numerator and theˆ
denominator of sinc are zero forx=0, so
lim
x→ 0
sin(x)
x
=lim
x→ 0
dsin(x)/dx
dx/dx
= 1
n It is bounded, indeed
− 1
x
≤
sin(x)
x
≤
1
x
- Since the dc component ofx(t)is 1, once it is subtracted it is clear that the rest of the series can
be represented as a sum of cosines:
x(t)= 1 +
∑∞
k=−∞,k6= 0
sin(πk/ 2 )
(πk/ 2 )
ejk^2 πt
= 1 + 2
∑∞
k= 1
sin(πk/ 2 )
(πk/ 2 )
cos( 2 πkt)
This can also be seen by considering the trigonometric Fourier series ofx(t). Sincex(t)sin(k 0 t)
is odd, asx(t)is even and sin(k 0 t)is odd, then the coefficients corresponding to the sines in
the expansion will be zero. On the other hand,x(t)cos(k 0 t)is even and gives nonzero Fourier
coefficients. See Equations (4.20).
- In general, the Fourier coefficients are complex and as such need to be represented by their
magnitudes and phases. In this case, theXkcoefficients are real-valued, and in particular zero
whenkπ/ 2 =±mπ,man integer, or whenk=±2,±4,.... Since theXkvalues are real, the
corresponding phase would be zero whenXk≥0, and±πwhenXk<0. In Figure 4.5 we show
a period of the signal, and the magnitude and phase line spectra displayed only for positive
values of frequency (with the understanding that the magnitude spectrum is even and the
phase is odd functions of the frequency).