#Transmission power effiency n = ((m**2)/(2+(m**2)))*100% where m is modulated index
#Given modulated indices are m1 = 0.25, m2 = 0.5 & m3 = 0.75
#Transmission power effiencies are n1, n2 & n3 respectively for m1, m2 & m3
n1 = ((0.25**2)/(2+(0.25**2)))*100
n2 = ((0.5**2)/(2+(0.5**2)))*100
n3 = ((0.75**2)/(2+(0.75**2)))*100
print 'Transmission power effiency for modulated index 0.25 is %.4f'%n1, '%'
print 'Transmission power effiency for modulated index 0.5 is %.4f'%n2, '%'
print 'Transmission power effiency for modulated index 0.75 is %.4f'%n3, '%'
import math
#Given input inmedance of matching networkis R1 = 10 ohm & output impedance of matching networ is R2 = 50 ohm & carrier frequency is fc = 500 KHz
R1 = 10.
R2 = 50.
fc = 500000.
#Wc = 2*pi*fc
Wc = 2*math.pi*fc
#AS R1 = R2*(X2**2)/[(R2**2)+(X2**2)], X2 = 25ohm
X2 = 25
#AS X1 = (R2**2)*X2/[(R2**2)+(X2**2)] & R1>R2, X1 = -20ohm
X1 = -20
#|X1| = |jwL| = wL = 20 & |X2| = |1/jwC| = 1/wC = 25, so |X1*X2| = L/C = 500 denotes as LC_div
LC_div = 500
#Wc**2 = 1/(L*C). LC is denoted as LC_prod
LC_prod = 1/(Wc**2)
#In the textbook the calculated LC = 10**-3, in reality the value of LC = 1.013D-13
L = math.sqrt(LC_div*LC_prod)
#In the textbook the calculated L**2 = 50*10**-14, in reality the value of L**2 = 5.066D-11
C = L/500
#In the textbook the calculated C = 1.4*10**-9, in reality the value of C = 1.424D-08
print 'Inductance %.3e'%L,' H'
print 'Capacitance %.3e'%C,' F'
#Given ohmnic loss resismath.tance is Ro = 12 Ohm,
Ro = 12.
#radiation resismath.tance is Rr = 48 Ohm,
Rr = 48.
#directivity is D = 2
D = 2.
#Input current = 0.1*math.cos[2*pi*(10**6)*t], Amplitude of input current is A = 0.1 Amp
A = 0.1
#Equivalent resismath.tance = Re = Ro+Rr
Re = Ro+Rr
#Total power used in antenna = Pin = (A**2)*Re/2
Pin = (A**2)*Re/2
#Power used in radiation = Prad = (A**2)*Rr/2
Prad = (A**2)*Rr/2
#Efficiency of the antenna = n = Prad/Pin
n = Prad/Pin
#Gain of antenna = Ga = efficiency*directivity
Ga = n*D
print 'Total power used in antenna ',Pin,' Watt'
print 'Power used in radiation ',Prad,' Watt'
print 'Efficiency of the antenna ',n
print 'Gain of antenna ',Ga