import math
import cmath
#Variable declaration
def mod(n):
r=n.real
i=n.imag
x=math.sqrt(r**2+i**2)
return x
S11=0.894*cmath.exp(complex(0,-60.6*math.pi/180))
S12=0.02*cmath.exp(complex(0,62.4*math.pi/180))
S21=3.122*cmath.exp(complex(0,123.6*math.pi/180))
S22=0.781*cmath.exp(complex(0,-27.6*math.pi/180))
#Calculations
deln=mod((S11*S22)-(S12*S21))
k=(1+mod(deln)**2-mod(S11)**2-mod(S22)**2)/2/mod(S12*S21)
#Results
print "|del|=%.4f"%deln
print "k=%.4f"%k
import math
import cmath
#Variable declaration
Zo=50 #ohms
S11=0.6*cmath.exp(complex(0,-155*math.pi/180))
S22=0.48*cmath.exp(complex(0,-20*math.pi/180))
S12=0
S21=6*cmath.exp(complex(0,180*math.pi/180))
Ss11=0.606*cmath.exp(complex(0,155*math.pi/180))
Ss22=0.48*cmath.exp(complex(0,20*math.pi/180))
def mod(n):
r=n.real
i=n.imag
x=math.sqrt(r**2+i**2)
return x
#Calculations&Results
#k=(1-mod(S11)**2-mod(S22)**2+mod(del)**2)/(2*mod(S12*S21))
deln=mod(S11*S22-S12*S21)
print "mod(del)=%.3f"%mod(deln)
GTUmax=(1-mod(Ss11)**2)*mod(S21)**2/mod((1-mod(S11)**2))**2*(1-mod(Ss22)**2)/mod((1-mod(S22)**2))**2
print "GTUmax=%.4f"%GTUmax
print "GTUmax in dB=%.3f"%(10*math.log10(GTUmax))
import math
import cmath
#Variable declaration
S11=0.614*cmath.exp(complex(0,-167.4*math.pi/180))
S21=2.187*cmath.exp(complex(0,32.4*math.pi/180))
S12=0.046*cmath.exp(complex(0,65*math.pi/180))
S22=0.716*cmath.exp(complex(0,-83*math.pi/180))
def mod(n):
r=n.real
i=n.imag
x=math.sqrt(r**2+i**2)
return x
#Calculations&Results
deln=(S11*S22-S12*S21)
B1=1+mod(S11)**2-mod(S22)**2-mod(deln)**2
B2=1+mod(S22)**2-mod(S11)**2-mod(deln)**2
C1=S11-S22*deln
C2=S22-S11*deln
print "del=%.4f"%mod(deln)
k=(1-mod(S11)**2-mod(S22)**2+mod(deln)**2)/(2*mod(S12*S21))
print "k=%.4f"%k
FMS=(B1-cmath.sqrt(B1**2-4*mod(C1)**2))/(2*C1)
print "FMS=",FMS
FML= (B2-cmath.sqrt(B2**2-4*mod(C2)**2))/(2*C2)
print "FML=",FML
GTmax=mod(S21)/mod(S12)*(k-math.sqrt(k**2-1))
print "GTmax=%.3f"%GTmax
print "GTmax in dB=%.2f dB"%(10*math.log10(GTmax))
import math
import cmath
#Variable declaration
#for transistor A
def mod(n):
r=n.real
i=n.imag
x=math.sqrt(r**2+i**2)
return x
S11=0.45*cmath.exp(complex(0,math.pi/180*150))
S12=0.01*cmath.exp(complex(0,-math.pi/180*10))
S21=2.05*cmath.exp(complex(0,math.pi/180*10))
S22=0.4*cmath.exp(complex(0,-math.pi/180*150))
#Calculations&Results
UA=(mod(S12)*mod(S21)*mod(S11)*mod(S22))/(1-mod(S11)**2)/(1-mod(S22)**2)
print "UA=%.5f"%UA
#for transistor B
S11=0.641*cmath.exp(complex(0,-math.pi/180*171.3))
S12=0.057*cmath.exp(complex(0,math.pi/180*16.3))
S21=2.058*cmath.exp(complex(0,math.pi/180*28.5))
S22=0.572*cmath.exp(complex(0,-math.pi/180*95.7))
UB=(mod(S12)*mod(S21)*mod(S11)*mod(S22))/(1-mod(S11)**2)/(1-mod(S22)**2)
print "UB=%.4f"%UB
import math
import cmath
#Variable declaration
S11=0.75*cmath.exp(complex(0,-120*math.pi/180))
S22=0.6*cmath.exp(complex(0,-70*math.pi/180))
S21=2.5*cmath.exp(complex(0,80*math.pi/180))
def mod(n):
r=n.real
i=n.imag
x=math.sqrt(r**2+i**2)
return x
#Calculations&Results
GSmax=1/(1-mod(S11)**2)
GLmax=1/(1-mod(S22)**2)
Go=mod(S21)**2
print "GSmax=%.5f"%GSmax
print "GSmax in dB=%.2f"%(10*math.log10(GSmax))
print "GLmax=%.4f"%GLmax
print "GLmax in dB=%.2f"%(10*math.log10(GLmax))
print "Go=%.2f"%Go
print "Go in dB=%.2f"%(10*math.log10(Go))
GTUmax=10*math.log10(GSmax*GLmax*Go)
print "GTUmax=%.2f"%GTUmax
import math
import cmath
#Variable declaration
Gs=10**0.5
S11=2.27*cmath.exp(complex(0,-math.pi/180*120))
S21=4*cmath.exp(complex(0,math.pi/180*50))
S12=0
S22=0.6*cmath.exp(complex(0,-math.pi/180*80))
Ss11=2.27*cmath.exp(complex(0,math.pi/180*120))
def mod(n):
r=n.real
i=n.imag
x=math.sqrt(r**2+i**2)
return x
#Calculations&Results
#(b)
gs=Gs*(1-mod(S11)**2)
Rs=(1-mod(S11)**2)*math.sqrt(1-gs)/(1-(1-gs)*mod(S11)**2)
ds=gs*(Ss11)/(1-(1-gs)*mod(S11)**2)
print "\nGs=%.4f\ngs=%.4f\nRs=%.4f"%(Gs,gs,Rs)
print "ds=",ds
Gs=10**.3
gs=Gs*(1-mod(S11)**2)
Rs=(1-mod(S11)**2)*math.sqrt(1-gs)/(1-(1-gs)*mod(S11)**2)
ds=gs*(Ss11)/(1-(1-gs)*mod(S11)**2)
print "\nGs=%.f\ngs=%.4f\nRs=%.4f"%(Gs,gs,Rs)
print "ds=",ds
GLmax=1./(1-mod(S22)**2)
print "GLmax=%.4f"%GLmax
Go=mod(S21)**2
print "Go=%.f"%Go
GTU=3+10*math.log10(GLmax*Go)
print "\nGTU=%.4f dB"%GTU