import math
# Variable Declaration
Pi = 10; # Input power in mW
CF = 20; # coupling factor in dB
# calculations
# CF(db) = 10*math.log(Pi/Pc)
Pc = Pi/(float((10**(CF/float(10)))));# antilog conversion and coupling power
# Result
print'Coupled Power = %d uW'%(Pc*10**3);
import math
# Variable Declaration
Pi = 10; # Input power in mW
IL = 0.4; # insertion loss in dB
# calculations
# ILdb = 10log(Pi/Po)
Po = Pi/float((10**(IL/10))) # antilog conversion and coupling power
# Result
print'Power available at the straight through port output = %3.3f mW'%Po;
import math
# Variable Declaration
CF = 20; # Coupling factor in dB
I = 50; # Isolation in dB
Pc = 100*10**-6; # coupling power in W
# calculations
# D = 10log(Pc/Piso)
D = I - CF; # Directivity in dB
Piso = Pc/float((10**(D/float(10)))) # antilog conversion and coupling power
# Result
print'Directivity = %d dB\n'%D,'Power at isolated port = %d nW'%(Piso*10**9);
import math
# Variable Declaration
CF = 20; # coupling factor in dB
D = 30; # Directivity in dB
Pin = 10; # input power in dBm
# Calculations
# 10logPi = Pin
Pi = 10**(Pin/10); # power in mW
I = D + CF # isolation in dB
Pc = Pin - CF;
Pcwatts = 10**(Pc/10) # power at coupled port in mW
Piso = Pin - I
Pisowatts = 10**(Piso/10) # Power at isolated port in mW
Po = Pi -(Pcwatts + Pisowatts); # power at o/p port in mW
# Result
print'Power Available at the output port = %3.5f mW'%Po;
import math
# Variable Declaration
Pi = 5*10**-3; # Input power in W
CF = 10; # coupling factor
Piso = 10*10**-6 # power at isolated port in w
# calculations
# CF = 10log(Pi/Pc)
Pc = Pi/(10**(CF/10)) # antilog conversion and coupling power
# D = 10log(Pc/Piso) # Directivity
D = 10*math.log10(Pc/Piso)
# Result
print'Directivity = %3.0f dB\n'%D;
import math
# given data
a = 2; # width in cm
b = 1; # Height in cm
d = 3; # length in cm
c = 3*10**10; # vel in free space in cm/s
# For TE101 mode
m = 1
n = 0;
p = 1;
# Calculations
fo = (c/float(2))*math.sqrt((m/float(a)**2)+ ((n/float(b))**2 )+ (p/float(d))**2);
# Output
print'Resonant Frequency = %d Ghz' %(fo/float(10**9));
import math
# given data
fo = 10; # resonant freq in Ghz
# output
print'The Resonant frequency for a TM mode in a rectangular cavity resonator for a given integral\n';
print'values of m,n and p is same as that of a TE mode for same values of m,n and p\n';
print'Therefore,TM111 mode resonant frequency = %d Ghz'%fo;
import math
# Variable Declaration
a = 4; # width in cm
b = 2; # Height in cm
c = 3*10**10; # vel in free space in cm/s
fo = 6*10**9; # resonator frequency in Ghz
# For TE101 mode
m = 1
n = 0;
p = 1;
# Calculations
#fo = (c/float(2))*math.sqrt((m/float(a)**2 + (n/float(b)**2 + (p/float(d)**2);
d = math.sqrt(((p**2)/((((2*fo)/float(c))**2) - ((m/float(a))**2) -((n/float(b))**2))));
# Result
print'Length of cavity resonator = %3.1f cm'%d;
import math
# Variable Declaration
a = 4; # width in cm
b = 2; # Height in cm
c = 3*10**10; # vel in free space in cm/s
fo = 6*10**9; # resonator frequency in Ghz
d = 3.2; # length of cavity resonator in cm
# For TE101 mode
m = 1
n = 0;
# Calculations
lamda_c = 2/(float(math.sqrt(((m/float(a))**2) + ((n/float(b))**2)))); # cut-off wavelength in m
lamda = c/float(fo); # operating wavelength in m
lamda_g = lamda/(float(math.sqrt(1 - ((lamda/float(lamda_c))**2))));# guide wavelength in m
# output
print'Length of resonator is %3.1f cm'%d,' and guide wavelength is %3.1f cm'%(lamda_g);
print'\nlength of resonator is half of guide wavelength';
import math
# Variable Declaration
di = 8; # internal diameter in cms
a = 4; # internal radius in cms
fo = 10*10**9; # operating frequency in Ghz
ha01 = 2.405; # Eigen value of bessel function
c = 3*10**10 # velocity of EM wave in cm/sec
# For TM011 mode
m = 0
n = 1
p = 1
# Calculations
#f0 = (c/2*pi)*sqrt((ha/a)**2 + (p*pi/d)**2) operating frequency
d = (p*math.pi)/(math.sqrt((fo*2*math.pi/c)**2 - (ha01/a)**2)) #length of resonator
# result
print'Length of resonator = %3.3f cm'%d;
import math
# Variable Declaration
di = 6; #internal diameter in cms
d = 5; #length in cm
a = 4; #internal radius in cms
fo = 10*10**9; #perating frequency in Ghz
ha01 = 2.405; #Eigen value of bessel function
ha11 = 1.841; #Eigen value of bessel function
c = 3*10**10 #velocity of EM wave in cm/sec
#For TM011 mode and TE111 mode
m0 = 0
m1 = 1
n1 = 1
p1 = 1
p2 = 2
# Calculations
f0 = (c/(2*math.pi))*math.sqrt((ha01/a)**2 + (p2*math.pi/d)**2) #resonant frequency for TM012 mode
f01 = (c/(2*math.pi))*math.sqrt((ha11/a)**2 + (p1*math.pi/d)**2) # resonant frequency for TE111 mode
# Result
print'Resonant frequency for TM012 mode = %3.3f Ghz\n'%(f0/float(10**9)), 'Resonant frequency for TM111 mode = %3.3f Ghz\n'%(f01/float(10**9 ));