Chapter 1: Introduction to Communication Systems

Example 1.1, page no. 10

In [1]:
# Variable Declaration
T      = 1.00*pow(10,-3)                                             # Time (s)
Tau    = 500.00*pow(10,-6)                                           # Pulse Width (s)
A      = 10.00                                                       # Amplitude (V)

# Calculation
import math                                                          # Math Library
Coeff1 = A*(Tau/T)     # Coefficient 1
Coeff2 = 2*A*(Tau/T)*math.sin((Tau/T)*math.pi)/((Tau/T)*math.pi)     # Coefficient 2
Coeff3 = 2*A*(Tau/T)*math.sin(2*(Tau/T)*math.pi)/(2*(Tau/T)*math.pi) # Coefficient 3
Coeff4 = 2*A*(Tau/T)*math.sin(3*(Tau/T)*math.pi)/(3*(Tau/T)*math.pi) # Coefficient 4

# Result
print "The Coefficients of First Four Terms in the Fourier Series are:"
print "Coeff1 =",round(Coeff1)
print "Coeff2 =",round(Coeff2,3)
print "Coeff3 =",round(Coeff3)
print "Coeff4 =",round(Coeff4,3)
print "f(t) = [",round(Coeff1),"] + [",round(Coeff2,3),"cos(2pi*10^3*t) ] + [",round(Coeff3),"] + [",round(Coeff4,3),"cos(6pi*10^3*t)","]"
The Coefficients of First Four Terms in the Fourier Series are:
Coeff1 = 5.0
Coeff2 = 6.366
Coeff3 = 0.0
Coeff4 = -2.122
f(t) = [ 5.0 ] + [ 6.366 cos(2pi*10^3*t) ] + [ 0.0 ] + [ -2.122 cos(6pi*10^3*t) ]

Example 1.2, page no. 12

In [2]:
# Variable Declaration
f      = 0.50*pow(10,3)    # First Zero Crossing (Hz)
Fw_max = 8.00*pow(10,-3)    # Amplitude (V)

# Calculation
import math                         # Math Library
Tau    = 1/f                        # Pulse Duration (s)
A      = Fw_max/Tau                 # Maximum Voltage (V)   

# Result
print "The single pulse has a maximum voltage of",round(A),"V and a duration of",round(Tau*pow(10,3)),"ms."
The single pulse has a maximum voltage of 4.0 V and a duration of 2.0 ms.