Data Communications
Lab 2
Detection of Spectrum of a Periodic Pulse Train
Dr. Md. Imdadul Islam
Professor, Department of Computer Science and Engineering
Jahangirnagar University
[Link]
Cosine components s(t)
𝑎0 A
τ DC/Average value
-T/2 T/2
T t
2𝜋
Fundamental 𝑎1 cos 𝑡
𝑇
Second harmonic 2𝜋. 2
𝑎2 cos 𝑡
𝑇
Third harmonic 2𝜋. 3
𝑎3 cos 𝑡
𝑇
Sine components s(t)
𝑎0 A
τ DC/Average value
-T/2 T/2
T t
2𝜋
Fundamental 𝑏1 sin 𝑡
𝑇
Second harmonic 2𝜋. 2
𝑏2 sin 𝑡
𝑇
Third harmonic 2𝜋. 3
𝑏3 sin 𝑡
𝑇
2 2
The amplitude of spectrum, 𝐶𝑛 = 𝑎𝑛 + 𝑏𝑛
Cn
𝐶1 = 𝑎12 + 𝑏12
𝐶2 = 𝑎22 + 𝑏22 𝐶1 𝐶0 𝐶1
𝐶2 𝐶2
𝐶3 = 𝑎32 + 𝑏32 𝐶3
𝐶3
… … … n
-3 -2 -1 0 1 2 3
Spectrum of rectangular pulse train
Detection of Spectrum of a Periodic Pulse Train
Objective of this experiment is to analyze the impact of period and width of a
pulse on its spectrum. Consider a rectangular pulse train of fig. 1 where the
amplitude of the pulse, A = 2 volts, period, T = 2 seconds and pulse width, τ = 0.2
seconds. The generalized expression of Fourier series,
∞
𝑎0 2 2𝜋𝑛 2𝜋𝑛
𝑠(𝑡) = + 𝑎𝑛 cos 𝑡 + 𝑏𝑛 sin 𝑡
𝑇 𝑇 𝑇 𝑇
𝑛=1
s(t)
A The period of the pulse train is T
τ The frequency of the pulse train is fc=1/T
t
T
∞
𝑎0 2 2𝜋𝑛 2𝜋𝑛
𝑠(𝑡) = + 𝑎𝑛 cos 𝑡 + 𝑏𝑛 sin 𝑡
𝑇 𝑇 𝑇 𝑇
𝑛=1
;where the constants an and bn (called Fourier co-efficient) give the peak value
of frequency components of n/T Hz, is given as,
𝑇/2 𝑇/2
2𝜋𝑛𝑡 2𝜋𝑛𝑡
𝑎𝑛 = 𝑥(𝑡) cos 𝑑𝑡 𝑏𝑛 = 𝑥(𝑡) sin 𝑑𝑡
𝑇 𝑇
−𝑇/2 −𝑇/2
𝑎0 = 𝐿𝑡𝑛→0 𝑎𝑛
The amplitude spectrum (or characteristics) is the plot of nfc vs. 𝑎𝑛2 + 𝑏𝑛2 and phase
−𝑏𝑛
characteristics is the plot of f vs. 𝑡𝑎𝑛−1 6
𝑎𝑛
𝑇/2 𝜏/2
2𝜋𝑛𝑡 2𝜋𝑛𝑡 sin 𝑐 𝑥 =
sin(𝜋𝑥)
𝑎𝑛 = 𝑥(𝑡) cos 𝑑𝑡 = 𝐴. cos 𝑑𝑡 = 𝐴𝜏 sin 𝑐 (𝑛𝜏/𝑇) 𝜋𝑥
𝑇 𝑇
−𝑇/2 −𝜏/2
𝑇/2
2𝜋𝑛𝑡
𝑏𝑛 = 𝑥 𝑡 sin 𝑑𝑡 = 0 The amplitude of spectrum, 𝐶𝑛 = 𝑎𝑛2 + 𝑏𝑛2 = 𝐴𝜏 sin 𝑐 (𝑛𝜏/𝑇)
𝑇
−𝑇/2
s(t)
A
τ
T/2 T/2
T
t
7
The amplitude of spectrum, 𝐶𝑛 = 𝑎𝑛2 + 𝑏𝑛2 = 𝐴𝜏 sin 𝑐 (𝑛𝜏/𝑇)
Cn
sinc(0) = 1, sinc(-t) = sinc(t)
sinc(k) = 0, where k is an integer
Aτsinc(τ/T) Aτ Aτsinc(τ/T)
Aτsinc(2τ/T) Aτsinc(2τ/T)
Aτsinc(3τ/T) Aτsinc(3τ/T)
-3 -2 -1 0 1 2 3
n
Spectrum of rectangular pulse train
8
The amplitude of spectrum, 𝐶𝑛 = 𝑎𝑛2 + 𝑏𝑛2 = 𝐴𝜏 sin 𝑐 (𝑛𝜏/𝑇)
Cn
sinc(0) = 1, sinc(-t) = sinc(t)
sinc(k) = 0, where k is an integer
Separation between two spectral lines,
Aτsinc(τ) Aτ Aτsinc(τ)
(n+1)/T – n/T =1/T= fc
Aτsinc(2τ) Aτsinc(2τ)
Aτsinc(3τ) Aτsinc(3τ)
n/T
-3/T -2/T -1/T 0 1/T 2/T 3/T
-3fc -2fc -fc 0 fc 2fc 3fc nfc
Spectrum of rectangular pulse train
Spectrum of periodic signal is discrete 9
Spectrum of rectangular pulse train A=2, T=2 and Tau=0.2 units
0.4
0.35
%MATALB source code 0.3
A=2; 0.25
n=-15:1:15; 0.2
T=2;
Cn
0.15
tau=0.2; 0.1
0.05
Cn=A*tau*sinc(n*tau/T); 0
stem(n/T,Cn, 'k') -0.05
xlabel('nf') -0.1
-8 -6 -4 -2 0 2 4 6 8
ylabel('Cn') nf
title('Spectrum of rectangular pulse train A=2, T=2 and Tau=0.2 units')
grid on
10
For zero crossing points, Cn = 0
𝑛𝜏
⇒ 𝐴𝜏 𝑠𝑖𝑛 𝑐 =0
𝑇
𝑛𝜏
⇒ 𝑠𝑖𝑛 𝑐 =0
𝑇
-3/𝜏 -2/𝜏 -1/𝜏 1/𝜏 2/𝜏 3/𝜏
𝑠𝑖𝑛( 𝜋𝑛𝜏/𝑇)
⇒ =0
n/T 𝜋𝑛𝜏/𝑇
⇒ 𝑠𝑖𝑛( 𝜋𝑛𝜏/𝑇) = 0
⇒ 𝜋𝑛𝜏/𝑇 = 𝑚𝜋
Therefore, n/T = m/τ
The zero crossing points on Cn vs n/T plot are ±1/τ, ±2/τ, ±3/τ, … … …
11
%Impact of impact of τ on shifting of zero crossing points
subplot(2,1,1)
n=-20:1:20;
T=10; Let us now show the impact of pulse width, τ on
tau=2; spectrum. The following code reveals the spectrum of
d=tau/T; the wave of fig. 1 for τ = 2 and τ = 1.
y=sinc(n*d);
tau=2
stem(n/T,y, 'k') 1
title('tau=2') 0.5
subplot(2,1,2) 0
tau=1; %reduced -0.5
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
d=tau/T; tau=1
1
y=sinc(n*d);
stem(n/T,y, 'k') 0.5
title('tau=1') 0
-0.5
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
12
%Impact of T
subplot(2,1,1) Let us now see the impact of period, T
n=-10:1:10;
T=2;
tau=0.2;
d=tau/T;
y=sinc(n*d); T=2
1
stem(n/T,y, 'k') 0.8
title('T=2') 0.6
subplot(2,1,2) 0.4
0.2
n=-5:1:5; 0
-5 -4 -3 -2 -1 0 1 2 3 4 5
T=1;
T=1
tau=0.2; %reduced 1
d=tau/T;
y=sinc(n*d); 0.5
stem(n/T,y, 'k')
0
title('T=1') -5 -4 -3 -2 -1 0 1 2 3 4 5
13
Python Code
14
#Spectrum of rectangular pulse train
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import pyplot as plt
A=2;
n = [Link](-15, 15, 1)
T=2
tau=0.2
Cn=A*tau* [Link](n*tau/T);
[Link](n/T, Cn)
[Link]('x')
[Link]('y')
[Link]('Spectrum of rectangular pulse train A=2, T=2 and Tau=0.2 units')
[Link](True, which='both')
[Link]()
Let us now show the impact of pulse width, τ on spectrum. The following code
reveals the spectrum of the wave of fig. 1 for τ = 2 and τ = 1.
#Impact of tau
import numpy as np [Link](212)
from matplotlib import pyplot as plt tau=1; #reduced
from matplotlib import pyplot as plt d=tau/T;
[Link](211) y=[Link](n*d);
n = [Link](-15, 15, 1) [Link](n/T,y)
T=10; [Link]('tau=1')
tau=2; [Link](True, which='both')
d=tau/T; [Link]()
y= [Link](n*d);
[Link](n/T,y)
[Link]('tau=2’)
[Link](True, which='both')
Let us now see the impact of period, T
#Impact of T
import numpy as np [Link](212)
from matplotlib import pyplot as plt n = [Link](-5, 5, 1)
from matplotlib import pyplot as plt T=1;
[Link](211) tau=0.2; #reduced
n = [Link](-15, 15, 1) d=tau/T;
T=2; y=[Link](n*d);
tau=0.2; [Link](n/T,y)
d=tau/T; [Link]('T=1')
[Link](True, which='both')
y= [Link](n*d);
[Link]()
[Link](n/T,y)
[Link]('T=2')
[Link](True, which='both')