In [3]:

```
#calcualate the carrier frequency
#given
import math
L = 50*10**-6#in henry
C = 1*10**-9#in farads
#calculation
F_c = 1/(2.*math.pi*math.sqrt(L*C))/1000.;
#results
print '%s %d %s' %("Carrier frequency F_c =",math.ceil(F_c)," kHz")
print("Now , it is given that the highest modulation frequency is 8KHz ");
print("Therefore, the frequency range occupied by the sidebands will range from 8KHz \nabove to 8KHz below the carrier frequency, extending fom 712KHz to 720KHz.");
```

In [5]:

```
#calculate the modulation index, upper and lower sideband frequency, bandwidth of modulation signal
#given
#v_m = 10*sin(2*%pi*10^3*t)
#by comparing with v_m = V_m*sin(2*%pi*f_c*t) we get
V_m = 10.#in volts
f_m = 1*10**3#in hertz
V_c = 20.#in volts
f_c = 1*10**4#in hertz
#calculations
m_a = V_m/V_c;#modulation index formula
m_a1 = m_a*100;#percentage modulation index
f_usb = f_c + f_m;#Upper sideband
f_lsb = f_c - f_m;#lower sideband
A = (m_a*V_c)/2#amplitude of upper as well as lower sideband
B = 2*f_m;#bandwidth of the modulation signal
#results
print '%s %.2f' %("i.a.Modulation index= ",m_a);
print '%s %d %s' %(" b.Percentage modulation index=",m_a1," percent");
print '%s %.f %s' %("ii.a.Upper sidebandfrequency=",f_usb,"Hz");
print '%s %.f %s' %(" b.Lower sideband frequency=",f_lsb,"Hz ");
print '%s %.f %s' %("iii.Amplitude of Upper sideband and Lower sideband =",A,"V");
print '%s %.f %s' %("\iv.Bandwidth of the modulation signal=",B,"Hz");
```

In [7]:

```
#calculate the total power in the amplitude modulated wave
#given
m_a = .75;#modulation index
P_c = 400.;#carrier power in watts
#calculation
P_t = P_c*(1+(m_a**2/2));#total power
#results
print "Total power in the amplitude modulated wave (in W) = ",P_t;
```

In [8]:

```
#calculate the carrier power
#given
P_t = 10*10**3;#total power in watts
m_a = .6;#modulation index
#calculation
P_c = (P_t/(1+(m_a**2/2)));# carrier power
#results
print "Carrier power (in kW) = ",round(P_c/1000.,2)
```

In [10]:

```
#calculate the modulation index and antenna current
import math
#given
I_t = 8.93;#total modulated current in ampers
I_c= 8;#carrier or unmodulated current in ampers
#calculation
m_a = math.sqrt(2*((I_t/I_c)**2 -1));#formula for modulation index
M_a=m_a*100;#percentage modulation
#for
m_a1 = .8;#given modulation index
#calculation
I_t1 = I_c*math.sqrt(1+(m_a1**2/2));#new antenna current
#results
print "i.a. Modulation index = ",round(m_a,3)
print "b.Percentage modulation index (percent) = ",round(M_a,1)
print "ii. Antenna current (in A) = ",round(I_t1,2)
```

In [11]:

```
#calculate the carrier signal current, modulation indexes
import math
#given
I_t1 = 10#antenna current in amps
m1 = .3#modulation index
I_t2 = 11#increased antenna current
#calculation
I_c = (I_t1/(1+(m1**2/2))**.5);#formula for carrier signal current
m_t = math.sqrt(2*((I_t2/I_c)**2 -1));#formula for modulation index
m2 = math.sqrt(m_t**2 - m1**2);
m3 = m2*100;#percentage modulation index
#results
print "i.Carrier signal current (in A) = ",round(I_c,2)
print "ii.Modulation index of signal = ",round(m_t,2)
print "iii.a.Modulation index of second signal = ",round(m2,2)
print "b.Percentage modulation index of second signal (percent) = ",round(m3,0)
```

In [1]:

```
#calculate the modulating. maximum, minimum voltage
#given v_c = 10*sinwt
m = .5#modulation index
#by comparing with v_c = V_c*sinwt
V_c = 10#carrier voltage in volts
#calculation
V_m = m*V_c;#amplitude of modulating index
V_max = V_c + V_m;#maximum voltage
V_min = V_c - V_m;#minimum voltage
#results
print " i.Modulating voltage =",round(V_m,2),"V"
print " ii. Maximum voltage =",round(V_max,2),"V"
print " iii.Minimum voltage =",round(V_min,2),"V"
```

In [2]:

```
#calculate the percentag4e modulation index
#given
V_max = 4.#maximum voltage in volts
V_min = 1.#minimum voltage in volts
#calculation
m = (V_max - V_min)/(V_max + V_min) ;#formula for modulation index
m1 = m*100.#percentage modultion index
#result
print "Percentage modulation index =",round(m1,2),"percent"
```

In [4]:

```
#calculate the carrier current and total modulation index
import math
#given
m1 = .4#modulation index
I_t1 = 11.#initial antenna current in ampers
I_t2 = 12.#final antenna current in ampers
#calculations
I_c = (I_t1/(1+(m1**2/2))**.5);# formula for carrier current in ampers
m_t = math.sqrt(2*((I_t2/I_c)**2 -1));#total modulation index
m2 = math.sqrt(m_t**2 - m1**2);#modulation index to the second wave
m3 = m2*100;#percentage modulation index to the second wave
#results
print " Carrier current =",round(I_c,2),"A"
print"Total modulation index =",round(m_t,4)
print "Percentage modulation index of second wave=",round(m3,2)," percent"
```

In [6]:

```
#calculate the modulation index and new transmitted power
import math
from math import sqrt
#given
P_c = 10.*10**3#carrier power in watts
P_t = 12.*10**3#total power in watts
m_2 = .5#modulation index of second wave
#calculations
m_1 = sqrt(2*((P_t/P_c)-1));#modulation index of first wave
m_t = sqrt(m_1**2 +m_2**2);#total modulation index
P_t1 = P_c*(1+(m_t**2/2))/1000.#total new transmitted power
#results
print "Modulation index of first wave =", round(m_1,4)
print "Total modulation index = ",round(m_t,1)
print "total new transmitted power =",round(P_t1,1),"kW"
```

In [8]:

```
#calculate the modulation index and total radiated power
import math
from math import sqrt
#given
P_t = 10.125*10**3#modulated or total power in watts
P_c = 9*10**3#unmodulated of carrier power
m_2 = .4#modulation index of second wave
#calculations
m_1 = sqrt(2*((P_t/P_c) - 1))#modulation index of first wave
m_a = m_1*100#percentage modulation index of first wave
m_t = sqrt(m_1**2 + m_2**2)#total modulation index
P_t1 = P_c*(1+(m_t**2/2))#total radiated power
#results
print "i.a.Modulation index of first wave = ",round(m_1,4)
print " b.Percentage modulation index of first wave =",round(m_a,2)," percent"
print "ii.Total radiated power =",round(P_t1,2)/1000.,"kW"
```

In [10]:

```
#calculate the percentage power saving for both signals
#given
m1 = 1.#modulation index of first signal
m2 = .5#modulation index of second signal
#let
P_c = 1.#carrier power in watts
#calculations
P_1= P_c*(1+(m1**2/2b))#total power of first signal
P_2 = P_c*(1+(m2**2/2))#total power of second signal
P_a = (P_c*100)/(P_1)#percentage power saving for first signal
P_b = (P_c*100)/(P_2)#percentage power saving for second signal
#results
print "i.Percentage power saving for first signal=",round(P_a,2)," percent"
print "ii.Percentage power saving for second signal=",round(P_b,2),"percent"
```

In [12]:

```
#calculate the percentage power saving for both signals
#given
m1 = 1.#modulation index of first signal
m2 = .5#modulation index of second signal
#let
P_c = 1.#carrier power in watts
#calculations
P_cssb1 = P_c*(1+(m1**2/4))#power in carrier plus power in one sideband for first signal
P_cssb2 = P_c*(1+(m2**2/4))#power in carrier plus power in one sideband for second signal
P_1= P_c*(1+(m1**2/2))#total power of first signal
P_2 = P_c*(1+(m2**2/2))#total power of second signal
P_a = (P_cssb1*100)/(P_1)#percentage power saving for first signal
P_b = (P_cssb2*100)/(P_2)#percentage power saving for second signal
#results
print "i.Percentage power saving for first signal=",round(P_a,2)," percent"
print "ii.Percentage power saving for second signal=",round(P_b,2),"percent"
```

In [14]:

```
#calculate the power content of the carrier in upper and lower sidebands
#given
P_ssb = 10*10**3#power in ssb transmission in watts
P_t = P_ssb# total power in watts
m_a = .8#modulation index
#calculations
P_c = (P_t/(1+(m_a**2/4)+(m_a**2/4)))#carrier power in watts
P_SB = P_t - P_c#power in sidebands
P_usb = P_SB/2.#power in upper sideband
P_lsb =P_usb#power in upper sideband
#results
print "i.Power content of the carrier =",round(P_c,2),"W"
print "ii.a.Power content in upper sideband =",round(P_usb),"W"
print " b.Power content in lower sideband =",round(P_lsb),"W"
```

In [16]:

```
#calculate the modulation index
#given from the figure
P_maxpp = 2*80.#maximum peak to peak power in watts
P_minpp = 2*20.#minimum peak to peak power in watts
#calcualtions
m_a = (P_maxpp - P_minpp)/(P_maxpp + P_minpp)#modultaion index
M = m_a*100#percentage modulation index
#results
print "i.Modulation index = ",m_a
print "ii.Percentage modulation index =",round(M,2)," percent"
```

In [18]:

```
#calculate the modulation index
#given from the figure
P_maxpp = 2*50.#maximum peak to peak power in watts
P_minpp = 2*15.#minimum peak to peak power in watts
#calculations
m_a = (P_maxpp - P_minpp)/(P_maxpp + P_minpp)#modultaion index
M = m_a*100#percentage modulation index
#results
print "i.Modulation index = ",round(m_a,3)
print "ii.Percentage modulation index =",round(M,1),"percent"
```

In [20]:

```
#calculate the carrier power,transmission efficiency and carrier amplitude
#given
import cmath
import math
p_t = 50*10**3#total power
m_a = .707#modulation index
z = 50+0*1j;#load
#calculations
#first case
p_x = .5*(m_a)**2;
p_c = p_t/(1+p_x)#carrier power
#second case
n = ((p_c*p_x)/(p_c+(p_c*p_x)))*100;#transmission efficiency
#third case
a_c = cmath.sqrt(2*z*p_c);#peak carrier amplitude
#results
print "i. Carrier Power = ",round(p_c/1000.,0)," kW"
print "ii. Percentage Transmission efficiency =",round(n,2),"percent"
print "iii. Carrier amplitude =",round(abs(a_c),0)," V"
```

In [23]:

```
#calculate the efficiency for ma=0.5 and for ma=1
#given
ma1=0.5
ma2=1.
#calculations
eta1=ma1**2 /(ma1**2 +2) *100.
eta2= ma2**2 /(ma2**2 +2) *100.
#results
print "In case 1, efficiency = ",round(eta1,1),"percent"
print "In case 2, efficiency = ",round(eta2,1),"percent"
```

In [25]:

```
#calculate the modulation depth
#given
k = 2*10**-3#constants in amperes/square volts
k_1 = 0.2*10**-3#constant in amperes/square volts
print "we know that V_i(t) = cos(w_c*t) + .5*cos(w_m*t)"
print "given i_0 = 10 + k*V_i + k_1*V_i**2 "
print "therefore i_0 = 10 + 2*10**-3*[cos(w_c*t) + .5*cos(w_m*t)] + 2*10**-3*[cos(w_c*t) + .5*cos(w_m*t)]"
print "i_0 = 2*10**-3*cos(w_c*t) + ((.2*10**-3)/.5)*.5*cos(w_c*t)*cos(w_m*t)"
#Now the modulation depth will be
m = (.2*10**-3)/.5;
#result
print "Modulation depth = ",m
```

In [29]:

```
#calculate the power saving in both cases
#given
#percentage modulation for first case
Pm_1 = 100.
#percentage modulation for second case
Pm_2 = 50.
m_1 = 1.#modulation index for first case
m_2 = .5#modulation index for second case
P_c = 1.#let carrier power be one
#calcualations
#first case
P_t1 = P_c*(1+(m_1**2/2.))#total power
P_sb1 = P_c*(m_1**2/4.)#power in one side band
P_s1 = ((P_t1-P_sb1)/P_t1)*100.#power saving
#second case
P_t2 = P_c*(1+(m_2**2/2))#total power
P_sb2 = P_c*(m_2**2/4)#power in one side band
P_s2 = ((P_t2-P_sb2)/P_t2)*100.#power saving
#results
print "i. Power saving with percentage modulation 100 =",round(P_s1,1)," percent "
print "ii. Power saving with percentage modulation 50 =",round(P_s2,1)," percent"
```

In [28]:

```
#calculate the minimum value of fc
import math
#given
#the product signal is given by
#v(t) = s(t) * cos(2*%pi*t +phi) = x(t) *cos(2*%pi*f_c*t)*cos(2*%pi*f_c*t +phi)
#v(t) = x(t) *(cos(4*%pi*f_c*t +phi) +cos(phi))/2 = (x(t)/2)*cos(4*%pi*f_c*t +phi)+(x(t)/2)*cos(phi)
#the low pass filter will reject the first term. The maximum allowable value of phase angle(phi) can be found as under:
print "cos(phi_max) = ((x(t)/2)*cos(phi))/max((x(t)/2)*cos(phi))"
phi_max = math.acos(.95)*180/math.pi;
print "phi_max = ",round(phi_max,2)
print "In order to recover x(t) from v(t) using filter method, it is essential that the lowest frequency contained in the first term of v(t) must be greater than the highest frequency contained in the second term,i.e,"
print "2f_c -10KHz > 10KHz"
print "f_c >10KHz"
print "Hence, the minimum value of f_c will be"
print "f_c = 10KHz"
```