Chapter 10: Signal-Flow Graphs and their Applications

Example 10.10, Page 415

In [1]:
import math
import cmath

#Variable declaration
Zs=20.   #ohms
Zo=50.   #ohms
ZL=30.   #ohms

#Calculations&Results
S11=0.45*cmath.exp(complex(0,150*math.pi/180))
S21=0.01*cmath.exp(complex(0,-10*math.pi/180))
S12=2.05*cmath.exp(complex(0,10*math.pi/180))
S22=0.4*cmath.exp(complex(0,-150*math.pi/180))
def mod(n):
    r=n.real
    i=n.imag
    x=math.sqrt(r**2+i**2)
    return x

Fs=(Zs-Zo)/(Zs+Zo)
print "Fs=%.3f"%Fs
FL=(ZL-Zo)/(ZL+Zo)
print "FL=%.3f"%FL
Fin=S11+(S21*S12*FL)/(1-S22*FL)
print "Fin=",Fin
Fout=S22+(S21*S12*Fs)/(1-S11*Fs)
print "Fout=",Fout
GT=(1-Fs**2)*mod(S12)**2/mod(1-S11*Fs)**2*(1-FL**2)/mod(1-Fout*FL)**2
print "GT=%.4f"%GT
GP=mod(S12)**2*(1-mod(FL)**2)/mod(1-S22*FL)**2/(1-mod(Fin)**2)
print "GP=%.4f"%GP
GA=(1-mod(Fs)**2)/mod((1-S11*Fs))**2*mod(S12)**2/(1-mod(Fout)**2)
print "GA=%.4f"%GA

print "GT(dB)=%.1f dB\nGP(dB)=%.1f dB\nGA(dB)=%.1f dB"%(10*math.log10(GT),10*math.log10(GP),10*math.log10(GA))
Fs=-0.429
FL=-0.250
Fin= (-0.395305588494+0.224693772041j)
Fout= (-0.356818003545-0.198795154317j)
GT=5.4974
GP=5.9354
GA=5.8559
GT(dB)=7.4 dB
GP(dB)=7.7 dB
GA(dB)=7.7 dB

Example 10.11, Page 417

In [2]:
import math
import cmath

#Variable declaration
Zo=50   #ohms
S11=0.97*cmath.exp(complex(0,-43*math.pi/180))
S12=0.0
S21=3.39*cmath.exp(complex(0,140*math.pi/180))
S22=0.63*cmath.exp(complex(0,-32*math.pi/180))
FL=0.63*cmath.exp(complex(0,32*math.pi/180))
Fs=0.97*cmath.exp(complex(0,43*math.pi/180))

#Calculations&Results
def mod(n):
    r=n.real
    i=n.imag
    x=math.sqrt(r**2+i**2)
    return x

Fin=S11+S12*S21*FL/(1-S22*FL)
Fout=S22+S21*S12*Fs/(1-S11*Fs)
GTU=(1-mod(Fs)**2)/mod(1-mod(S11)*mod(Fs))**2*mod(S21)**2*(1-mod(FL)**2)/mod(1-mod(S22)*mod(FL))**2
print "GTU=%.2f"%GTU
GP=1/(1-mod(Fin)**2)*mod(S21)**2*(1-mod(FL)**2)/(1-mod(S22)*mod(FL))**2
print "GP=%.2f"%GP
GA=(1-mod(Fs)**2)*mod(S21)**2/(1-mod(S11)*mod(Fs))**2/(1-mod(Fout)**2)
print "GA=%.2f"%GA
GTU=322.42
GP=322.42
GA=322.42