In [4]:

```
from math import pi
# The values of constsnts Kf and Kp are given as Kf= 2*pi*10**5 and Kp=10*pi, and carrier frequency fc=100MHz
# For FM :
#fi= fc + Kf*m(t)/2*pi
# Minimum value of m(t) = -1 and Maximum value of m(t)= +1
Kf= 2*pi*10**5 #
Kp=10*pi#
fc=100*10**6 ## in Hz
Mmin = -1 #
Mmax=1#
fimin1= fc + Kf*Mmin/(2*pi)#
print 'Minimum frequency = %0.2f MHz'%(fimin1/10**6)
fimax1= fc + Kf*Mmax/(2*pi)#
print 'Maximum frequency = %0.2f MHz'%(fimax1/10**6)
#For PM :
#fi= fc + Kp*m(t)'/2*pi
# Minimum value of m(t)' = -20,000 and Maximum value of m(t)'= +20,000
Mmin1=-20000 #
Mmax1=20000#
fimin2= fc + Kp*Mmin1/(2*pi)#
print 'Minimum frequency = %.2f MHz'%(fimin2/10**6)
fimax2= fc + Kp*Mmax1/(2*pi)#
print 'Maximum frequency = %.2f MHz'%(fimax2/10**6)
# Since m(t) is increases and decreases linearly with time, the instantaneous frequency increases linearly from fimin to fimax
```

In [5]:

```
from math import pi
# The values of constsnts Kf and Kp are given as Kf= 2*pi*10**5 and Kp=pi/2, and carrier frequency fc=100MHz
# For FM :
#fi= fc + Kf*m(t)/2*pi
# Minimum value of m(t) = -1 and Maximum value of m(t)= +1
Kf= 2*pi*10**5 #
Kp=pi/2#
fc=100*10**6 ## in Hz
Mmin = -1 #
Mmax=1#
fimin1= fc + Kf*Mmin/(2*pi)#
print 'Minimum frequency = %.2f MHz'%(fimin1/10**6)
fimax1= fc + Kf*Mmax/(2*pi)#
print 'Maximum frequency = %.2f MHz'%(fimax1/10**6)
# Since m(t) is increases and decreases linearly with time, the instantaneous frequency increases linearly from fimin to fimax
```

In [6]:

```
from math import pi
# refer fig from page no. 212 Fig.5.4a
# The values of constsnts Kf and Kp are given as Kf= 2*pi*10**5 and Kp=5*pi .
# Here we are assuming the Bandwidth B of m(t) as the frequency of the third harmonic, i.e. 3(10**4/2)Hz= 15kHz
B=15## in kHz
# For FM:
# Here peak amplitude of m(t) is mp=1
mp=1#
# df=kf*mp/2*pi
Kf= 2*pi*10**5#
Kp=5*pi#
df= (Kf*mp)/(2*pi)## in Hz
df=df/10**3## in KHz
Bfm=2*(df+B)#
print 'Bfm = %.2f kHz'%(Bfm)
# For PM:
#Here peak amplitude of m(t)' is mp=20000
mp=20000#
# df=kp*mp/2*pi
df= (Kp*mp)/(2*pi)## in Hz
df=df/10**3## in KHz
Bpm=2*(df+B)#
print 'Bpm = %.2f kHz'%Bpm
```

In [7]:

```
from math import pi
# The values of constsnts Kf and Kp are given as Kf= 2*pi*10**5 and Kp=5*pi .
# Here we are assuming the Bandwidth B of m(t) as the frequency of the third harmonic, i.e. 3(10**4/2)Hz= 15kHz
B=15## in kHz
# For FM:
# Here peak amplitude of m(t) is doubled ,mp=2
mp=2#
# df=kf*mp/2*pi
Kf= 2*pi*10**5#
Kp=5*pi#
df= (Kf*mp)/(2*pi)## in Hz
df=df/10**3## in KHz
Bfm=2*(df+B)#
print 'Bfm = %.2f kHz'%Bfm
# For PM:
#Here peak amplitude of m(t)' is doubled mp=40000
mp=40000#
# df=kp*mp/2*pi
df= (Kp*mp)/(2*pi)## in Hz
df=df/10**3## in KHz
Bpm=2*(df+B)#
print 'Bpm = %.2f kHz'%Bpm
# doubling the signal amplitude roughly doubles the bandwidth of both FM and PM waveform
```

In [8]:

```
from math import pi
# Repeat example 5.3 with m(t) expanded by a factor of 2 i.e. if the period of m(t) is 4*10**-4
# The values of constsnts Kf and Kp are given as Kf= 2*pi*10**5 and Kp=5*pi .
# we know that time expansion by a factor 2 reduces the signal spectrum width by a factor 2
# Therefore bandwidth is half the previous bandwidth
B=7.5# # im KHz
# For FM:
# Time expansion does not affect the peak amplitude so that mp=1.
mp=1#
# df=kf*mp/2*pi
Kf= 2*pi*10**5#
Kp=5*pi#
df= (Kf*mp)/(2*pi)## in Hz
df=df/10**3## in KHz
Bfm=2*(df+B)#
print 'Bfm = %.2f kHz'%Bfm
# For PM:
#mp is halved i.e. mp=10000
mp=10000#
# df=kp*mp/2*pi
df= (Kp*mp)/(2*pi)## in Hz
df=df/10**3## in KHz
Bpm=2*(df+B)#
print 'Bpm = %.2f kHz'%Bpm
# Time expansion of m(t) has very little effect on the FM bandwidth, but it halves the PM bandwidth
```

In [10]:

```
from math import pi
#Assuming SI unit for all quantities
# An angle modulated signal with carrier frequency wc = 2*pi*10**5 is described by the equation Qem= 10cos(@(t)) where @(t)=wct+5sin3000t+10sin2000pi*t
B=2000*pi/(2*pi)##signal bandwidthis the highest frequency in m(t)
Ac=10##carrier amplitude
P=Ac**2/2## carrier power
print 'a) The carrier power is : %.2f Watt'%P
# to find frequency derivative df, e find instantaneous freq. w as
# wi=d/dt(@(t))= wc+15000cos3000t+20000pi*cos2000pi*t#
# The carrier derivative is 15000cos3000t+20000pi*cos2000pi*t. The two sinusoids will add in phase at some point and the maximum value of the expression is dW=15000+20000pi
dW=15000+20000*pi#
df=dW/(2*pi)#
print 'b) The frequency deviation = %.2f Hz'%df
# The deviation ratio B1 is given as
B1=df/B#
print 'c) The deviation ratio is: %.2f '%B1
#The phase deviation is the maximum value of the angle @(t) and is given b d@
d=5+10#
print 'd)The phase deviation = %.2f rad'%d
Bem=2*(df+B)#
print 'e)Bandwidth is : %.2f Hz'%Bem
```