272 C H A P T E R 4: Frequency Analysis: The Fourier Series
nExample 4.12
To illustrate the modulation property using MATLAB consider modulating a sinusoid cos( 20 πt)
with a train of square pulses
x 1 (t)=0.5[1+sign(sin(πt)]
and with a sinusoid
x 2 (t)=cos(πt)
Use our functionfourierseriesto find the Fourier series of the modulated signals and plot their
magnitude line spectra.
Solution
The functionsignis defined as
sign(x(t))=
{
− 1 x(t) < 0
1 x(t)≥ 0
(4.28)
That is, it determines the sign of the signal. Thus, 0.5[1+sign
(
sin(πt)]=u(t)−u(t− 1 )equals
1 for 0≤t≤1, and 0 for 1<t≤2, which corresponds to a period of a train of square
pulses.
The following script allows us to compute the Fourier coefficients of the two modulated signals.
%%%%%%%%%%%%%%%%%
% Example 4.12---Modulation
%%%%%%%%%%%%%%%%
syms t
T0 = 2;
m = heaviside(t)−heaviside(t−T0/2);
m1 = heaviside(t)−heaviside(t−T0);
x = m∗cos(20∗pi∗t);
x1 = m1∗cos(pi∗t)∗cos(20∗pi∗t);
[X, w] = fourierseries(x, T0, 60);
[X1, w1] = fourierseries(x1, T0, 60);
The modulated signals and their corresponding magnitude line spectra are shown in Figure 4.13.
The Fourier coefficients of the modulated signals are now clustered around the frequency 20π.