In [3]:

```
#calculate the carrier frequency, modulation frequency and max. frequency deviation, power dissipation
import math
#given
t=10 #sec
R = 10.#resistance in ohms
print "v(t) = 12*cos(6*10**8*t + 5*sin(1250*t));"
print "v(t) = A*cos(w_c*t + m_f*sin(w_m*t))"
#by comparing with standard
A = 12. #amplitude voltage in volts
w_c= 6*10**8 #angular carrier frequency in rad/sec
w_m = 1250. #angular modulating frequency in rad/sec
m_f = 5. #modulation index
#calculations
f_c = w_c/(2*math.pi)#carrier frequency
f_m = w_m/(2*math.pi)#modulating frequency
deltaf = m_f*f_m#maximum deviation
V_rms = (A/math.sqrt(2))**2#rms volatage
P = V_rms/R#power dissipatted
#results
print " i. Carrier frequency (MHz) = ",round(f_c/10**6,1)
print "ii. Modulation frequency (Hz) = ",round(f_m,0)
print "iii. Modulation index = ",m_f
print "iv.Maximum frequency deviation (Hz) = ", round(deltaf,0)
print "v.Power dissipated (W) = ",P
```

In [2]:

```
#calculate the carrier frequency, highest and lowest frequencies and modulating index
#given
f_c = 107.6*10**6#carrier frequency
f_m = 7.*10**3#modulating frequency
deltaf = 50.*10**3#frequency deviation
#calculations
cs = 2*deltaf#carrier swing
f_H = f_c + deltaf#highest frequency
f_L = f_c - deltaf#lowest frequency
m_f = deltaf/f_m#modulating index
#results
print "i.Carrier frequency (kHz) = ",cs/1000.
print "ii.a.Highest frequency attained by the modulating signal (MHz) = ",round(f_H/10**6,2)
print " b.Lowest frequency attained by the modulating signal (MHz) = ",round(f_L/10**6,2)
print "iii.modulating index of the FM wave = ",round(m_f,3)
```

In [9]:

```
#calculate the frequency deviation,carrier swing and lower frequency
#given
f_c = 105*10**6#carrier frequency
f_H = 105.007*10**6#highest frequency or upper frequency
#calculations
deltaf = f_H - f_c#frequency deviation
cs = 2*deltaf#carrier swing
f_L = f_c - deltaf#lower frequency
#results
print "i.Frequency deviation (kHz) = ",deltaf/1000.
print "ii.Carrier swing (kHz) = ",cs/1000.
print "iii.Lower frequency reached by the modulated wave (MHz) = ",round(f_L/10**6,3)
```

In [10]:

```
#calculate the modulation index
#given
cs = 100.*10**3#carrier swing
f_m = 8.*10**3#modulating frequency
#calculations
deltaf = cs/2.#frequency deviation
m_f = deltaf/f_m#modulation index
#results
print "Modulation index = ",m_f
```

In [12]:

```
#calculate the Percentage modulation index
#given
deltaf = 20.*10**3#frequency deviation
deltaf_actual = deltaf#since deltaf_actual equals to deltaf
deltaf_max1 = 75.*10**3#maximum frequency deviation deltaf_max permittedfor the first case is 75KHz
deltaf_max2 = 25.*10**3#maximum frequency deviation deltaf_max permitted for the second case is 25KHz
#calculations
M1 = (deltaf_actual/deltaf_max1)*100#persentage modulation index for first case
M2 = (deltaf_actual/deltaf_max2)*100#persentage modulation index for second case
#results
print "i.Percentage modulation index for first case (percent) = ",round(M1,2)
print "ii.Percentage modulation index for second case (percent) = ",M2
```

In [14]:

```
#calculate the bandwidth of a commercial FM transmission
#given
deltaf = 75.*10**3#frequency deviation
f_m = 15.*10**3#modulating frequency
#calculation
BW = 2*(deltaf+f_m)#bandwidth
#result
print "Bandwidth of a commercial FM transmission (kHz) = ",BW/1000.
```

In [16]:

```
#calculate the bandwidth of a narrowband FM signal
#given
f_m = 4.*10**3#modulation frequency
f_c = 125.*10**3#carrier frequency
#claculation
BW = 2*f_m#bandwidth
#result
print "Bandwidth of a narrowband FM signal (kHz) = ",BW/1000.
```

In [17]:

```
#calculate the bandwidth of a signal under required conditions
#given
deltaf1 = 75.*10**3#frequency deviation
f_m = 8.*10**3#modulation frequency
deltaf2 = 2*deltaf1#if modulation signal amplitude is doubled, the frequency deviation becomes double
#calculation
BW1 = 2*(deltaf1 +f_m)#bandwidth
BW2 = 2*(deltaf2 +f_m)#new bandwidth
#result
print "Bandwidth of a signal when modulating signal amplitude is doubled (kHz) = ",BW2/1000.
```

In [18]:

```
#calculate the modulation index and bandwidth
#given
f_m = 5.*10**3#modulating frequency
f_c = 50.*10**6#carrier frequency
deltaf = 20.*10**3#frequency deviation
#calculations
m_f = deltaf/f_m#modulation index
BW = deltaf*3.8#referring to the Schwartz bandwidth curve
#results
print "i.Modulation index = ",m_f
print "ii.Bandwidth of the FM signal (kHz) = ",BW/1000.
```

In [19]:

```
#calculate the modulating frequency
#given
BW = 50.*10**3#bandwidth
deltaf = 10.*10**3#frequency deviation
#calculation
x = BW/deltaf#variable
m_f = 2#by referring to the Schwartz bandwidth curve with 'x'
f_m = deltaf/m_f#modulating frequency
#results
print "Modulating frequency (kHz) = ",f_m/1000.
```

In [20]:

```
#calculate the modulation index and bandwidth in all cases
print ("EXAMPLE 5.11(PAGENO 217)");
#given
#x(t) = 5*cos(2*%pi*15*10**3*t)
V_m = 5.#amplitude of voltage
f_m = 15.*10**3#modulation frequency
k_f = 15.*10**3#frequency sensitivity
k_p = 15.*10**3#phase sensitivity
#calculations
#first case
#for FM system
delta_f1 = k_f * V_m;#frequency deviation for FM system
m_f1 = delta_f1/f_m; #modulation index in FM system
BW1 = 2*(delta_f1+f_m);#bandwidth for FM system
#for PM system
delta_f2 = k_f * V_m*f_m;#frequency deviation for PM system
BW2 = 2*(delta_f2 + f_m);#bandwidth for PM system
m_p1 = k_p * V_m#modulation index in PM system
#second case
f_m1 = 5*10**3#modulating frequency for second case
#for FM system
delta_f3 = k_p * V_m;#frequency deviation for FM system
m_f2 = delta_f3/f_m1; #modulation index in FM system
BW3 = 2*(delta_f3+f_m1);#bandwidth for FM system
#for PM system
delta_f4 = k_p * V_m*f_m1;#frequency deviation for PM system
BW4 = 2*(delta_f4 + f_m1);#bandwidth for PM system
m_p2 = k_p * V_m#modulation index in PM system
#results
print "i.a.Modulation index of FM system for first case =",m_f1
print " b.Bandwidth of FM system for first case (kHz) = ",BW1/1000.
print "ii.a.Modulation index of PM system for first case = ",m_p1
print " b.Bandwidth of PM system for first case (MHz) = ",round(BW2/10**6,0)
print "iii.a.Modulation index of FM system for second case = ",m_f2
print " b.Bandwidth of FM system for second case (kHz) = ",BW3/1000.
print "iv.a.Modulation index of PM system for second case (kHz) = ",m_p2/1000.
print " b.Bandwidth of PM system for second case (MHz) = ",round(BW4/10**6,0)
```

In [22]:

```
#calculate the carrier frequency, modulating frequency and index, deviation and power
import math
#given
#given that v = 10*sin((5 * 10**8 *t) + 4*sin(1250*t))
#by comparing with standard eqn i.e v = V_c*sin((w_c * t) + m_f*sin(w_m*t)) we get
w_c = 5.*10**8#angular carrier frequency
w_m = 1250.#angular modulating frequency
m_f = 4. #modulating index
V_c = 10. #carrier voltage in volts
R = 5. #resistance in ohms
#calculations
f_c = w_c/(2*math.pi)#carrier frequency
f_m = w_m/(2*math.pi)#modulating frequency
deltaf = m_f * f_m#maximum deviation
V_rms = (V_c/math.sqrt(2))**2#RMS value of FM wave
P = V_rms/R#power dissipated
#results
print "i.a.Carrier frequency (MHz) = ",round(f_c/10**6,2)
print " b.Modulating frequency (Hz) = ",round(f_m,0)
print "ii.a.Modulation index = ",m_f
print " b.Maximum deviation (Hz) = ",round(deltaf,0)
print "iii.Power dissipated in 5 ohms resistance (W) = ",P
```

In [24]:

```
#calculate the frequency deviation for modulating voltage
#given
f_m = 1.*10**3#modulating frequency
V_m = 2.#modulating voltage in volts
deltaf = 6.*10**3#frequency deviation
V_m1 = 4.#increased modulation voltage for first case
V_m2 = 8.#increased modulation voltage for second case
#calculations
k_f = deltaf/V_m#proportion constant
#first case
deltaf1 = k_f*V_m1#frequency deviation for first case
#second case
deltaf2 = k_f*V_m2#frequency deviation for second case
#results
print "i.Frequency deviation for modulating voltage 4V (kHz) = ",deltaf1/1000.
print "ii.Frequency deviation for modulating voltage 8V (kHz) = ",deltaf2/1000.
```

In [25]:

```
#calculate the modulation index
#given
deltaf = 6.*10**3#frequency deviation from the question of EXAMPLE 5.13(PAGENO 220)
f_m = 1.*10**3#modulating frequency from the question of EXAMPLE 5.13(PAGENO 220)
deltaf1 = 12.*10**3#frequency deviation from the EXAMPLE 5.13(PAGENO 220) of first case
deltaf2 = 24.*10**3#frequency deviation from the EXAMPLE 5.13(PAGENO 220) of second case
f_m1 = f_m#modulating frequency from the EXAMPLE 5.13(PAGENO 220) of first case
f_m2 = 500.#modulating frequency from the EXAMPLE 5.13(PAGENO 220) ofsecond case
#calculation
m_f = deltaf/f_m#modulation index for the initial conditions given in the problem 5.13
m_f1 = deltaf1/f_m1#modulation index for the first case
m_f2 = deltaf2/f_m2#modulation index for the second case
#results
print "a.Modulation index for initial conditions given in the problem 5.13 = ",m_f
print "b.Modulation index for the first case = ",m_f1
print "c.Modulation index for the second case = ",m_f2
```

In [27]:

```
#calculate the bandwidth of FM signal
#given
deltaf = 10.*10**3#frequency deviation
f_m = 1.*10**3#modulating frequency
#calculations
BW = 2*(deltaf + f_m)#bandwidth of FM signal
BW_DSB = 2*f_m#bandwidth of DSB FC(AM)
#results
print "i.Bandwidth of FM signal (kHz) = ",BW/1000.
print "ii.Bandwidth of DSB FC(AM) signal (kHz) = ",BW_DSB/1000.
```

In [29]:

```
#calculate the wave equations
import math
#given
#first case
f_c1 = 20.*10**6#carrier frequency
f_m1 = 400.#modulation frequency
V_c = 5.#carrier voltage in volts
deltaf = 10.*10**3#frequency deviation
#second case
f_m2 = 2.*10**3#modulation frequency
#calculations
w_c1 = 2 *math.pi *f_c1#angular carrier freqency
w_m1 = 2 *math.pi *f_m1#angular carrier freqency
m_f1 = deltaf/f_m1#modulation index for first case
m_f2 = deltaf/f_m2#modulation index for second case
#results
#standard format of fm and pm equations are
#s(t) = V_c8sin(w_c*t + m_f*sin(w_m*t))
print "(i)FM wave:s(t) =",m_f2,"*sin(1.25*10**8*t +",m_f1,"*sin(2513*t)"
print "(ii)PM wave:s(t) =",m_f2,"*sin(1.25*10**8*t +",m_f1,"*sin(2513*t)"
```

In [30]:

```
#calculate the carrier amplitude, maximum and minimum frequencies
#given
V_m = 5.#modulating voltage
f_m = 200.*10**3#modulating frequency
V_c = 10.#carrier voltage
f_c = 100.*10**6#carrier frequency
delta_f = 2.*10**3#frequeny deviation in hertz per volt
#calculations
m_a = delta_f/f_m#modulation index
print "for m_a = .5 the approximate values of j coefficients are"
print "J_0 = .94 J_1 = .24 J_2 =.03"
J_0 = .94
J_1 = .24
J_2 =.03
A_c = V_c*J_0;#carrier amplitude
A_1 = V_c*J_1;#amplitude of first pair of sideband
A_2 = V_c*J_2;#amplitude of second pair of sideband
f_1 = f_c + f_m#maximum frequency of first pair of sideband
f_1a = f_c - f_m#minimum frequency of first pair of sideband
f_2 = f_c + (2*f_m)#maximum frequency of second pair of sideband
f_2a = f_c - (2*f_m)#minimum frequency of second pair of sideband
#results
print "i.Carrier amplitude (V) = ",A_c
print "ii.Amplitude of first pair of sideband (V) = ",A_1
print "iii.Amplitude of second pair of sideband (V) = ",A_2
print "iV.a.Maximum frequency of first pair of sideband (MHz) = ",round(f_1/10**6,2)
print " .b.Minimum frequency of first pair of sideband (MHz) = ",round(f_1a/10**6,2)
print "V.a.Maximum frequency of second pair of sideband (MHz) = ",round(f_2/10**6,2)
print " .b.Minimum frequency of second pair of sideband (MHz) = ",round(f_2a/10**6,2)
```

In [31]:

```
#calculate the maximum frequency deviation for first case and modulation index for second case
#given
f_m1 = 400.#modulating frequency for first case
V_m1 = 2.4#modulating voltage for first case
f_m2 = 250.#modulating frequency for second case
V_m2 = 3.2#modulating voltage for second case
m_f1 = 60.#modulation index for first case
#calculations
delta_f1 = m_f1*f_m1#maximum frequency deviation for first case
k = delta_f1/V_m1#constant
delta_f2 = k*V_m2#frequency deviation for second case
m_f2 = delta_f2/f_m2#modulation index for second case
#results
print "i.Maximum frequency deviation for first case (kHz) = ",round(delta_f1/1000.,0)
print "ii.Modulation index for second case = ",m_f2
```

In [33]:

```
#calculate the modulation index and bandwidth for both cases
#given
f_m1 = 1.*10**3#modulating frequency for first case
f_m2 = 500.#modulating frequency for second case
V_m1 = 2.#modulating voltage for first case
V_m2 = 8.#modulating volatge for second case
delta_f1 = 4.*10**3#frequency deviation for first case
#calculations
k = delta_f1/V_m1#constant
delta_f2 = k*V_m2#frequency deviation for second case
m_f1 = delta_f1/f_m1#modulation index for first case
m_f2 = delta_f2/f_m2#modulation index for second case
BW1 = 2*(delta_f1 + f_m1)#bandwidth for first case
BW2 = 2*(delta_f2 + f_m2)#bandwidth for second case
#results
print "i.a.Modulation index for first case = ",m_f1
print " b.Bandwidth for first case (kHz) = ",BW1/1000.
print "ii.a.Modulation index for second case = ",m_f2
print " b .Bandwidth for second case (kHz) = ",BW2/1000.
print "Note: Their is error in textbook in the calculation of second case bandwidth "
```

In [34]:

```
#calculate the capacitive reactance
#given
g_m = 10*10**-3#transconductance
n = 8
f= 5*10**6#operating frequency
#calculation
X_Ceq = n/g_m#capacitive reactance
#result
print "Capacitive reactance (ohms) = ",X_Ceq
```

In [35]:

```
#calculate the carrier frequency and deviation, modulation index
#given data from block diagram
f_c = 10.*10**6#carrier frequency
delta_f = 10.*10**3#frequency deviation
m_f = 5.#modulation index
#calculations
#first stage
f_cA = 3 * f_c#carrier frequency at point A
delta_fA = 3 * delta_f#frequency deviation at point A
m_fA = 3 * m_f#modulation index at point A
f_maxA = f_cA + delta_fA#maximum frequency at point A
f_minA = f_cA - delta_fA#minimum frequency at point A
#second stage
f_cB = f_cA + f_c#carrier frequency at point B
f_maxB = f_maxA +f_c#maximum frequency at point B
f_minB = f_minA + f_c#minimum frequency at point B
delta_fB = f_maxB - f_cB#frequency deviation at point B
#their will no change in modulation index
#results
print "i.a.Carrier frequency at point A (MHz) = ",f_cA/10**6
print " b.Frequency deviation at point A (kHz) = ",delta_fA/10**3
print " c.Modulation index at point A = ",m_fA
print " d.Maximum frequency at point A (MHz) = ",round(f_maxA/10**6,3)
print " e.Minimum frequency at point A (MHz) = ",round(f_minA/10**6,3)
print "ii.a.Carrier frequency at point B (MHz) = ",f_cB/10**6
print " b.Frequency deviation at point B (kHz) = ",delta_fB/10**3
print " c.Modulation index at point B = ",m_fA
print " d.Maximum frequency at point B (MHz) = ",round(f_maxB/10**6,3)
print " e.Minimum frequency at point B (MHz) = ",round(f_minB/10**6,3)
```

In [39]:

```
#calculate the modulation index
#given
#first case
#The maximum deviation in commerical FM is given as
delta_f1 = 75.*10**3#frequency deviation in commerical FM
f_m1 = 30.#maximum modulating frequency
f_m2 = 15.*10**3#minimum modulating frequency
#second case
delta_f2 = 10.*10**3#frequency deviation for narrowband FM
f_m3 = 100.#maximum modulating frequency
f_m4 = 3.*10**3#minimum modulating frequency
#calculations
#first case
m_f1 = delta_f1/f_m1#modulation index for maximum modulating frequency
m_f2 = delta_f1/f_m2#modulation index for minimum modulating frequency
#second case
m_f3 = delta_f2/f_m3#modulation index for maximum modulating frequency
m_f4 = delta_f2/f_m4#modulation index for minimum modulating frequency
#results
print " i.a.modulation index for maximum modulating frequency of commercial FM = ",m_f1
print " b.modulation index for minimum modulating frequency of commercial FM = ",m_f2
print "ii.a.modulation index for maximum modulating frequency of narrowband FM = ",m_f3
print " b.modulation index for minimum modulating frequency of commercial FM = ",round(m_f4,2)
```

In [38]:

```
#calculate the modulation index
#given
print ('modulated carrier waveform is given by s(t) = A*sin((2*pi*f_c*t)+m_f*sin(2*pi*f_m*t))');
f_c = 100.*10**6#carrier frequency in hertz
delta_f = 75.*10**3#frequency deviation in hertz
f_m = 2.*10**3#modulating frequency
A = 5#peak voltage of carrier wave
#calculation
m_f = delta_f/f_m;#modulation index
#result
print " Modulation index = ",m_f
print ("Equation for modulated carrier waveform s(t) = 5*sin((2*pi*100*10**6*t)+37.5*sin(2*pi*2*10**3*t))");
```

In [40]:

```
#calculate the frequency sensitivity and modulation index
#given
#we know that s(t) = A*cos((2*%pi*f_c*t) + m_f*sin(2*%pi*f_m*t ))
f_c = 1.*10**6#modulation frequency
A = 3.#carrier amplitude in volts
#first case
A_m = 1.#modulating amplitude in volts for first case
delta_f = 1.*10**3#frequency deviation
f_m1 = 1.#modulating frequencyof first case
#second case
f_m2 = 2.*10**3#modulating frequency for second case
A_m2 = 5.#modulating amplitude for second case
#calculations
k_f = delta_f/f_m1#frequency sensitivity in hertz per volt
m_f = (delta_f*A_m2)/f_m2#modulating frequency
#desired FM signal can be expressed by s(t) = A*cos((2*%pi*f_c*t) + m_f*sin(2*%pi*f_m*t ))
#results
#standard FM signal expression is as follows
#s(t) = A*cos(2*%pi*f_c*t + m_f * sin(2*%pi*f_m*t))
print "Frequency sensitivity k_f (Hz/volt)= ",k_f
print "Modulation index m_f =",m_f
print ("s(t)=3*cos(2*pi*10**6*t + 2.5*sin(2*pi*2*10**3*t)");
```

In [41]:

```
#calculate the bandwidth and percentage of under estimation
#given
delta_f = 75.*10**3#frequency deviation
f_m = 15.*10**3#modulating frequency
#calculations
D = delta_f/f_m#deviation ratio
BW1 = 2*delta_f*(1+(1/D))#bandwidth of FM signal
#using universal curve, replacing m_f by D,we get
BW2 = 3.2*delta_f#for D = 5=3.2*75*10**3
BW = (BW2-BW1)*100/BW2#percentage of under estimation of bandwidth by using carson's rule
#results
print "i.Bandwidth of FM signal (kHz) = ",BW1/1000.
print "ii.Bandwidth obtained by replacing m_f by D (kHz) = ",BW2/1000.
print "iii.Percentage of under estimation of bandwidth by using Carson rule (percent) = ",BW
print "It means that cason s rule under estimates the band-width by 25% as compared with the result obtained from the universal curve."
```

In [47]:

```
#calculate the fraction of signal power
#given
m_f1 = 1.#modualtion index for first case
m_f2 = 10.#modualtion index for second case
#let
f_m = 1.*10**3#modulating frequency
#calulations
#the bandwidth for FM signal can be calculated on the basis of 98% power requirement given by Carson's rule
BW1 = 2*(m_f1+1)*f_m#bandwidth for first case
B1 = (2*m_f1 +1)*f_m#frequency band first case
BW2 = 2*(m_f2+1)*f_m#bandwidth for second case
B2 = (2*m_f2 +1)*f_m#frequency band second case
P1 = (B1/BW1)*(98.)#fraction of signal power that is included in freuency band for 1st case
P2 = (B2/BW2)*(98.)#fraction of signal power that is included in freuency band for 2nd case
#results
print "i.Fraction of signal power that is included in freuency band for 1st case (percent) = ",P1
print "ii.Fraction of signal power that is included in freuency band for 2nd case (percent) = ",round(P2,1)
print "Note: Their is mistake in calculation of fraction of power of second case in text book"
```

In [46]:

```
#calculate te bandwidth of FM signal in both cases
#given
f_m1 = 2.*10**3#modulating frequency for first case
delta_f1= 5.*10**3#frequency deviation for first case
f_m2 = 1.*10**3#modulating frequency for second case
delta_f2 = 3.*5*10**3#modulating frequency for second case
#calculations
BW1 = 2*(delta_f1 + f_m1)#bandwidth of the FM signal for first case
BW2 = 2*(delta_f2 + f_m2)#bandwidth of the FM signal for secpnd case
#results
print "i.Bandwidth of the FM signal for first case (kHz) = ",BW1/1000.
print "ii.Bandwidth of the FM signal for second case (kHz) = ",BW2/1000.
```

In [45]:

```
#calculate the carrier power and in each side band
#given
m_f = .2#modulation index
P = 10.*10**3#power of FM transmitter
J_0m_f = 0.99#bessel function
J_1m_f =0.099
#calculations
P_c = (J_0m_f)**2 * P#carrier power
P_s1 = (J_1m_f)**2 * P#power in each side frequency
P_s2 = P_s1
#results
print "i.Carrier power (kW) = ",round(P_c/1000.,1)
print "ii.power in each side band (W) = ",round(P_s1,1)
```

In [48]:

```
#calculate the carrier swing, modulation index, highest and lowest frequencies attained
#given
f_m = 7.*10**3#modulating frequency
delta_f = 50.*10**3#frequency deviation
f_c = 107.6*10**6#carrier frequency
#calculaitons
CS = 2*delta_f#carrier swing
m_f = delta_f/f_m#modulation index
f_h = f_c + delta_f#upper or highest frequency
f_l = f_c - delta_f#lower of lowest frequency
#results
print "i.a.Carrier swing (kHz) = ",CS/10**3
print " b.Modulation index = ",round(m_f,3)
print "ii.a.Highest frequency attained by the FM signal (MHz) = ",round(f_h/10**6,2)
print " b.Lowest frequency attained by the FM signal (MHz) = ",round(f_l/10**6,2)
```

In [50]:

```
#calculate the frequency deviation and carrier frequency
#given
f_c = 100.*10**6#carrier frequency
f_u = 100.007*10**6#upper frequency
#calculations
delta_f = f_u - f_c#frequency deviation
CS = 2*delta_f#carrier swing
f_l = f_c - delta_f#lower frequency reached by the modulated FM wave
#results
print "i.Frequency deviation (kHz) = ",delta_f/10**3
print "ii.Carrier frequency (kHz) = ",CS/10**3
print "iii.Lower frequency reached by the modulated FM wave (MHz) = ",round(f_l/10**6,3)
```

In [51]:

```
#calculate the Percentage modulation index
#given
CS = 125.*10**3#carrier swing
#calculations
delta_f = CS/2#frequency deviation
#since,maximum frequency deviation for the FM broadcast band is 75 KHz, therefore
f_m = 75.*10**3#modulating frequency
m_f = delta_f*100/f_m#modulation index
#result
print "Percentage modulation index (percent) = ",round(m_f,1)
```

In [53]:

```
#calculate the frequency deviation and modulation index for all cases
#given
#first case
f_m1 = 500.#modulating frequency
delta_f1 = 6.4*10**3#frequency deviation
V_m1 = 3.2#modulating amplitude
#second case
V_m2 = 8.4#modulating amplitude
#third case
V_m3 = 20.#modulating amplitude
f_m3 = 200.#modulating frequency
#calculations
k_f = delta_f1/V_m1#frequency sensitivity
delta_f2 = k_f*V_m2#frequency deviation for second case
delta_f3 = k_f*V_m3#frequency deviation for third case
m_1 = delta_f1/f_m1#modulation index for first case
m_2 = delta_f2/f_m1#modulation index for second case
m_3 = delta_f3/f_m3#modulation index for third case
#results
print "i.a.Frequency deviation for first case (kHz) = ",delta_f1/10**3
print " b.Modulation index for first case = ",m_1
print "ii.a.Frequency deviation for second case (kHz) = ",delta_f2/10**3
print " b.Modulation index for second case = ",m_2
print "iii.a.Frequency deviation for third case (kHz) = ",delta_f3/10**3
print " b.Modulation index for third case = ",m_3
```

In [54]:

```
#calculate the carrier frequency, modulating frequency, modulation index, frequency deviation and power dissipated by the wave
import math
#given
# s(t) = 20*sin(6*10**8*t + 7*sin(1250*t))
#comparing with standard eqn s(t) = A*sin(w_c*t + m_f*sin(w_m*t))
#we get
w_c = 6.*10**8#carrier angular frequency in rad/sec
w_m = 1250.#modulating angular frequency in rad/sec
m_f = 7.#modualation index
A = 20.#amplitude of modulated wave
R = 100.#resistance
#calculations
f_c = w_c/(2*math.pi)#carrier frequency in hertz
f_m = w_m/(2*math.pi)#modulating frequency in hertz
delta_f = m_f*f_m#frequency deviation
P = (A/math.sqrt(2))**2/R#power dissipated
#results
print "i.Carrier frequency (MHz) = ",round(f_c/10**6,1)
print "ii.Modulating frequency (Hz) = ",round(f_m,0)
print "iii.Modulation index = ",m_f
print "iv.Frequency deviation (Hz) = ",round(delta_f,0)
print "v.Power dissipated by FM wave (W) = ",P
```

In [55]:

```
#calculate the maximum frequency deviation
import math
#given
#x_c(t) = 10*cos[(10**8*math.pi*t) + 5*sin(2*math.pi*10**3)t]
#by comparing the given x_c(t) with standard FM wave equation
t=10;
w_c = 10**8#carreier frequency
phi_t = 5*math.sin(2*math.pi*10**3*t);
phi_1t = 5*2*math.pi*10**3*math.cos(2*math.pi*10**3*t)
#Therefore, the maximum phase deviation will be
phi_tmax = 5#radians
#calculation
delta_f = (5*10**3*2*math.pi)/(2*math.pi);#maximum frequency deviation
#results
print "Maximum frequency deviation is (kHz) = ",delta_f/1000.
```

In [56]:

```
#calculate the bandwidth
import math
#given
#x_c(t) = 10*cos(2*math.pi*10**8*t + 200*cos (2*math.pi*10**3*t))
#instantaneous frequecy w_i = 2*math.pi*10**8 - 4*math.pi*10**6*sin(2*math.pi*10**3)
delta_w = 4*math.pi*10**5#angular frequency deviation
w_m = 2*math.pi*10**3#angulat modulating frequency
#calculations
beeta = delta_w/w_m;
W_B1 = 2*(beeta + 1)*w_m;#angular bandwidth
#since beeta >>1,therefore
W_B1 = 2*delta_w#angular bandwidth
#W_B==W_B1
f_B = W_B1/(2*math.pi)#bandwidth in Hz
#result
print "Bandwidth (kHz) = ",f_B/1000.
```

In [57]:

```
#calculate the modulation index and bandwidth for all cases
#given
f_c = 20.*10**6#carrier frequency
delta_f = 100.*10**3#frequency deviation
f_m1 = 1.*10**3#modulation index for first case
f_m2 = 100.*10**3#modulation index for second case
f_m3 = 500.*10**3#modulation index for third case
#calculations
beeta1 = delta_f/f_m1
beeta2 = delta_f/f_m2
beeta3 = delta_f/f_m3
m_f1 = delta_f/f_m1#modulation index for first case
m_f2 = delta_f/f_m2#modulation index for second case
m_f3 = delta_f/f_m3#modulation index for third case
f_B1 = 2*delta_f#bandwidth for first case since it is a WBFM signal
f_B2 = 2*(beeta2 + 1)*f_m2#bandwidth for second case
f_B3 = 2*f_m3#bandwidth for third case since it is a NBFM signal
#results
print "i.a.Modulation index for first case = ",m_f1
print " b.Bandwidth for first case (kHz) = ",f_B1/1000.
print "ii.a.Modulation index for second case = ",m_f2
print " b.Bandwidth for second case (kHz) = ",f_B2/1000.
print "iIi.a.Modulation index for third case = ",m_f3
print " b.Bandwidth for third case (MHz) = ",f_B3/10**6
print "Note:Their is error in first case modulating frequency in text book"
```

In [58]:

```
#calculate the bandwidth in all cases
#given
#x_c(t) = 10*cos(w_c*t + 3*sin(w_m*t))
#comparing with std eqn of PM signal x_PM(t) = A*cos(w_c*t + k_p*m(t))
#m(t) = a_m*sin(w_m*t)
#beeta = k_p*a_m
beeta = 3;
f_m1 = 1.*10**3#modulating frequency for first case
f_m2 = 2.*10**3#modulating frequency for second case
f_m3 = 500.#modulating frequency for third case
#calculations
f_B1 = 2*(beeta + 1)*f_m1#bandwidth for first case
f_B2 = 2*(beeta + 1)*f_m2#bandwidth for first case
f_B3 = 2*(beeta + 1)*f_m3#bandwidth for first case
#results
print "i.Bandwidth for first case (kHz) = ",f_B1/1000.
print "ii.Bandwidth for second case (kHz) = ",f_B2/1000.
print "ii.Bandwidth for third case (kHz) = ",f_B3/1000.
```

In [59]:

```
#calculate the bandwidth in all cases
#given
#x_cFM(t) = 10*cos(w_c*t + 3*sin(w_m*t))
#by omparing with standard equation i.e A*cos(w_c*t + beta*sin(w_m*t))
#we get
beta = 3.
#calculations
#first case
f_m1 = 1.*10**3#modulating frequency for first case
f_B1 = 2.*(beta +1)*f_m1#bandwidth for first case
#second case
beta2 = 3./2#beta for second case
f_m2 = 2.*10**3#modulating frequency for second case
f_B2 = 2.*(beta2 +1)*f_m2#bandwidth for second case
#third case
beta3 = 6.#beta for third case
f_m3 = .5*10**3#modulating frequency for third case
f_B3 = 2*(beta3 +1)*f_m3#bandwidth for third case
#results
print "i.Bandwidth for first case (Hz) = ",f_B1/1000.
print "ii.Bandwidth for second case (Hz) = ",f_B2/1000.
print "ii.Bandwidth for third case (Hz) = ",f_B3/1000.
```

In [60]:

```
#calculate the bandwidth, frequency deviation
#given
f_m = 2.*10**3#modulating frequency for first case
delta_f1 = 5.*10**3#frequency deviation for first case
f_m1 = 1.*10**3#modulating frequency for second case
#beeta = (k_f*a_m)/(w_m) = delta_f/f_m
#calculations
beeta = delta_f1/f_m
f_B1 = 2*(beeta + 1)*f_m#bandwidth for first case
#beeta1 = (k_f*3*a_m)/(.5*w_m) = delta_f/f_m therefore
beeta1 = 6*beeta
delta_f2 = beeta1 * f_m1 #frequency deviation for second case
f_B2 = 2*(beeta1 + 1)*f_m1#bandwidth for second case
#results
print "i.Bandwidth for first case (kHz) = ",f_B1/1000.
print "ii.a.Frequency deviation for second case (kHz) = ",delta_f2/1000.
print " b.Bandwidth for second case (kHz) = ",f_B2/1000.
```

In [62]:

```
#calculate the bandwidth
#given
delta_f = 75.*10**3#frequency deviation
f_M = 15.*10**3#modulating frequency
#calculations
#we have w_m = 2*%pi*f_M where f_M = 15KHz,we get
D = delta_f/f_M#deviation ratio
#by using thr given formula, the bandwidth will be
f_B1 = 2*(D+2)*f_M
#Using Carson's rule, the bandwidt will be
f_B2 = 2*(D+1)*f_M
#results
print "i.Bandwidth calculation using the given formula (kHz) = ",f_B1/1000.
print "ii.Bandwidth calculation using the carson rule (kHz) = ",f_B2/1000.
```

In [63]:

```
#calculate the frequency multiplication and maximum allowed frequency deviation
#given
#x_NBFM(t) = A*cos(w_c*t + sin(w_m*t))
f_c = 200.*10**3#carrier frequency
f_m_max = 15.*10**3#maximum modulating frequency
f_m_min = 50.#minimum modulating frequency
delta_f = 75.*10**3#maximum frequency deviation
#calculations
beeta_min = delta_f/f_m_max;
beeta_max = delta_f/f_m_min;
#if beeta_1 =.5, where beeta_1 is the input beeta, then the required frequency multiplication will be
beeta_1 = .5
n = beeta_max/beeta_1#frequency multiplication
delta_f1 = delta_f/n#maximum allowed frequency deviation
#results
print "i.Frequency multiplication = ",n
print "ii.Maximum allowed frequency deviation (Hz) = ",delta_f1
```

In [64]:

```
#calculate the maximum frequency deviation and carrier frequency
#given
f_1 = 200.*10**3#frequency applied at first stage
delta_f1 = 25.#frequency deviation at first stage
n1 = 64.#frequency multiplication at first stage
n2 = 48.#frequency multiplication at second stage
f_LO = 10.8*10**6#frequency of oscillator as shown if block diagram
#calculations
delta_f = delta_f1*n1*n2#maximum frequency deviation
f_2 = n1*f_1#frequency applied at second stage
f_3a = f_2 + f_LO#frequency applied the third stage
f_3b = f_2 - f_LO#frequency applied the third stage
f_c1 = n2*f_3a#carrier frequency for maximun f_3
f_c2 = n2*f_3b#carrier frequency for minimum f_3
#results
print "i.Maximum frequency deviation (kHz) = ",delta_f/1000.
print "ii.a.Carrier frequency for maximum f_3 (MHz) = ",f_c1/1000000.
print " b.Carrier frequency for minimum f_3 (MHz) = ",f_c2/1000000.
```

In [65]:

```
#calculate the mixer oscillator frequency
#given
f_c = 108.*10**6#carrier frequency
f_1 = 2.*10**5#crystal oscillator frequency
beta = .2#phase deviation
f_m = 50.#minimum frequency
delta_f = 75.*10**3#frequency deviation
n_2 = 150.
#calculations
delta_f1 = beta * f_m;
n_12 = delta_f /delta_f1;
#f_2 = n_1*f_1 = n_1 * 2*10**5Hz
#assuming down convertions, we have
#f_2 - f_LO = (f_c/n_2)
#thus
f_LO = ((n_12*f_1) - f_c)/n_2;
n_1 = n_12/n_2
#results
print " n_1 = ",n_1
print " Mixer oscillator frequency (MHz) = ",f_LO/10**6
```

In [66]:

```
#calculate the frequency multiplication for both PM and FM waves
#given
delta_f = 50.#frequency deviation
delta_f2 = 20.*10**3#frequency deviation for sinusoidal FM wave i.e second case
f_m1 = 120.#modualting frequency for first case
f_m2 = 240.#modulating frquency for second case
#calculations
#first case
delta_f1 = (f_m2/f_m1)*delta_f#frequency deviation for sinusoidal PM wave
n1 = delta_f2/delta_f1#frequency multiplication for sinusoidal PM wave
#second case
n2 = delta_f2/delta_f#frequency multiplication for sinusoidal FM wave
#results
print "i.Frequency multiplication for PM wave = ",n1
print "ii.Frequency multiplication for FM wave = ",n2
```