from __future__ import division
from math import pi
#Given
fc=5e9 #Hz
Em=2e7 #V/m
vs=4e3 #ms/s
Xc=1 #ohm
#Maximum allowable power
Pm=((Em*vs)**2)/(((2*pi*fc)**2)*Xc)
print 'Maximum allowable power: %0.3f'%Pm, 'W'
#Given
XeGe=4.0 #eV
XeGaAs=4.1 #eV
delEgGe=0.78 #eV
delEgGaAs=1.42 #eV
#Conduction band differential
delEc=XeGe-XeGaAs
print 'Conduction band differential:' ,delEc,'eV'
#Valence band differential
delEv=delEgGaAs-delEgGe-delEc
print 'Valence band differential:' ,delEv,'eV'
#Given
S11=0.89
S12=0.02
S21=3.1
S22=0.78
Del=(S11*S22)-(S12*S21)
K=(1-(S11)**2-(S22)**2+(Del)**2 )/(2*S12*S21)
if(K<1):
print 'Amplifier is potentially unstable'
else:
print 'Amplifier is potentially stable'
#Given
S11=0.40
S12=0.01
S21=2.00
S22=0.35
ZL=20 #ohm
ZS=30 #ohm
Z0=ZL+ZS #ohm
#Reflection coefficients of source and load
TL=(ZL-Z0)/(ZL+Z0)
TLm=-TL
TS=(ZS-Z0)/(ZS+Z0)
TSm=-TS
#Reflection coefficients of input and output
Tin=S11+((S12*S21*TL)/(1-(S22*TL)))
Tout=S22+((S12*S21*TS)/(1-(S22*TS)))
#Transducer Gain
x=(1-(TSm)**2)/((1-(S11*TSm))**2) #Value of should be 1.145
y=(S21*S21)
z=(1-(TLm)**2)/((1-(Tout*TLm))**2)
GT=x*y*z
print 'Transducer Gain: %0.3f'%GT
#Available Power Gain
z1=1-(Tout)**2
GA=(x*y)/z1
print 'Available power Gain: %0.3f'%GA
#Power Gain
z2=1-(Tin)**2
GP=(x*y)/z2
print 'Power Gain: %0.3f'%GP
#All the end calculations of finding gain are not accurate in the book, hence the answers dont match
from math import sqrt
#Given
S11=0.60
S12=0.045
S21=2.50
S22=0.50
TS=0.5
TL=0.4
Vrms=10 #V
Z0=50 #ohm
#(i)Reflection coefficients of input and output
Tin=S11+((S12*S21*TL)/(1-(S22*TL)))
Tout=S22+((S12*S21*TS)/(1-(S22*TS)))
print 'Reflection coefficients of input: %0.3f'%Tin
print 'Reflection coefficients of output:' ,Tout
#(ii) Gains
#Transducer Gain
x=(1-(TS)**2)/((1-(S11*TS))**2)
y=(S21*S21)
z=(1-(TL)**2)/((1-(Tout*TL))**2)
GT=x*y*z
print 'Transducer Gain: %0.3f'%GT
#Available Power Gain
z1=1-(Tout)**2
GA=(x*y)/z1
print 'Available power Gain: %0.3f'%GA
#Power Gain
z2=1-(Tin)**2
GP=(x*y)/z2
print 'Power Gain: %0.3f'%GP
#Calculation for Tout and Gains are wrong in the book, hence the answers dont match
#(iii) Power available
Gt=9.4
Pas=(sqrt(2)*Vrms)**2/(8*Z0)
Pal=Gt*Pas
print 'Power available at source:' ,Pas,'W'
print 'Power available at load:',Pal, 'W'
from math import log10
#Given
S11=0.90
S12=0
S21=2.40
S22=0.80
Gmax=(S21*S21)/((1-(S11)**2)*(1-(S22)**2))
Gdb=10*log10(Gmax)
print 'Maximum gain: %0.3f'%Gdb
#Given
e=1.6e-19
Nd=1.1e23 #m-3
a=0.2e-6 #m
er=11.8
e0=8.854e-12
mue=800e-4 #m2/Vs
Z=50e-6
L=8.5e-6 #m
W0=1 #V
Vd=12 #V
Vg=1.5 #V
#(i) Pinch off voltage and pinch off current
Vp=(e*Nd*a*a)/(2*er*e0)
print 'Pinch off voltage: %0.3f'%Vp,'V'
Ip=(mue*e*e*Nd*Nd*Z*a*a)/(e0*er*L)
print 'Pinch off current: %0.3f'%Ip,'A'
#Answer for Ip is 55809 A but it is given as 0.00558 A
#(ii) Drain and maximum drain current
#Taking Ip=5.58mA as given in book
Ip1=0.00558 #A
x=(2/3)*(((Vd+Vg+W0)/Vp)**(3/2))
y=(2/3)*(((Vg+W0)/Vp)**(3/2))
Id=Ip1*((Vd/Vp)-x+y)
print 'Drain current: %0.3f'%-Id,'A'
#Saturation Current
Is=Ip1*((1/3)-((Vg+W0)/Vp)+((2/3)*(((Vg+W0)/Vp)**(3/2))))
print 'Drain saturation current: %0.3e'%Is, 'A'
#(iii) Cut off frequency
f=(2*mue*e*Nd*a*a)/(pi*er*e0*L*L)
print 'Cutt off freqency: %0.3f'%(f/10**9),'GHz'
#Given
e=1.6e-19
Nd=8e23 #m-3
a=0.12e-6 #m
er=13.2
e0=8.854e-12
#Pinch off voltage
Vp=(e*Nd*a*a)/(2*er*e0)
print 'Pinch off voltage:' ,Vp,'V'
#Given
vd=2e5 #m/s
L=10e-6 #m
Ec=3.2e5 #V/m
#Natural frequency
f=vd/L
print 'Natural frequency:' ,f/10**9,'GHz'
#Critical voltage
Vc=Ec*L
print 'Critical voltage:',Vc, 'V'
#Given
n=0.08
A=3e-8 #m2
n0=1e21 #m-3
e=1.6e-19
vd=1.5e5 #m/s
M=3.2
E=350e3 #V
L=12e-6 #m
#Power output
Pout=n*A*n0*e*vd*M*L*E
print 'Power output:' ,Pout*1000,'mW'
#Given
G=15.85
Rn=75 #ohm
Rl=Rn-(Rn/G)
C=Rl+(10*1J)
print 'Cavity impedance: {:.3f}'.format(C), 'ohms'
#Given
e=1.6e-19
n1=1e16 #m-3
mu1=8000e-4 #m2/Vs
nu=1e14 #m-3
muu=180e-4 #m2/Vs
#/Conductivity
C=e*((n1*mu1)+(nu*muu))
print 'Conductivity: %0.3f'%(C*1000),'m mho'
#Given
e0=8.854e-12
er=13.1
vd=2.5e5 #m/s
e=1.6e-19
mu=0.015 #m2/Vs
#Criteria
n0L=(e0*er*vd)/(e*mu)
print 'n0L should be greater than %0.3e'%n0L,'m**-3'
#Given
L=10e-6 #m
f=10e9 #Hz
e=1.6e-19
n0=2e20 #m3
E=3200e2 #V/m
#Current density
vd=L*f
J=n0*e*vd
print 'Current density:' ,J,'A/m sqr'
#Negative electron mobility
mu=-vd/E
print 'Negative electron mobility:' ,mu*10000,'cm sqr/Vs'
#Answer for Negative electron mobility is 3125 but it is given as 3100
#Given
n=0.15
Vdc=100 #V
Idc=200e-3 #A
vd=2e5 #m/s
L=6e-6 #m
#(i) Maximum CW output power
Pdc=Vdc*Idc
Pout=n*Pdc
print 'Maximum CW power output:' ,Pout,'W'
#(ii) Resonant frequency
f=vd/(2*L)
print 'Resonant frequency: %0.3f'%(f/10**9),'GHz'
#Given
n=0.1
Vdc=100 #V
Idc=100e-3 #A
vd=2e5 #m/s
L=5e-6 #m
V0=90 #V
k=3
#(i) Maximum CW output power
Pdc=Vdc*Idc
Pout=n*Pdc
print 'Maximum CW power output:' ,Pout,'W'
#(ii) Resonant frequency
f=vd/(2*L)
print 'Resonant frequency:' ,f,'Hz'
#(iii)Transit time
T=L/vd
print 'Transit time:' ,T,'s'
#(iv) Avalanche multiplication factor
M=1/(1-((Vdc/V0)**k))
print 'Avalanche multiplication factor: %0.3f'%-M
#Given
n=0.1
Vdc=100 #V
Idc=0.9 #A
t=0.01e-9 #s
f=16e9 #Hz
#(i)Power output
Pdc=Vdc*Idc
Pout=n*Pdc
print 'Power output:' ,Pout,'W'
#(ii)Duty cycle
D=(t/2)+(1/(2*f))
print 'Duty cycle:',D, 's'
#Given
Cj=0.5e-12 #F
Lp=0.5e-9 #H
Irf=0.65 #A
Rl=2 #ohms
Vbd=80 #V
Idc=0.08 #A
#Resonant frequency
f=1/(2*pi*sqrt(Cj*Lp))
print 'Resonant frequency: %0.3f'%f,'Hz'
#Efficiency
Pout=(Irf*Irf*Rl)/2
Pin=Vbd*Idc
n=(Pout*100)/Pin
print 'Efficiency: %0.3f'%n, '%'
#Given
J=25e7 #A/m
Na=2.5e21 #m3
e=1.6e-19
#Avlance zone velocity
vz=J/(Na*e)
print 'Avlanche zone velocity:' ,vz,'m/s'
#Given
e=1.6e-19
N=4e21 #m
L=10e-6 #m
e0=8.854e-12
er=11
#Breakdown voltage
Vbd=(e*N*L*L)/(e0*er)
print 'Breakdown voltage:' ,round(Vbd),'V'
#Breakdown electric field
E=Vbd/L
print 'Breakdown electric field: %0.3f'%E, 'V/m'
#Given
lam=8000e-10 #m
a=0.5e-2 #m
D=4e8 #m
#Angular Spread
t=(1.22*lam)/a
print 'Angular spread:',t, 'rad'
#Aerial spread
A=pi*((D*t)**2)
print 'Aerial spread:',A, 'm sqr'
#Answer for A is given as 193 m sqr but it is 1.915e10 m sqr
#Given
E=10 #W
T=1e-9 #s
c=3e8 #m/s
lam=650e-9 #m
#Pulse Power
P=E/T
print 'Pulse Power:' ,P,'W'
#Q value
Q=(c*T)/lam
print 'Q value: %0.3f'%Q
#Given
h=6.626e-34
c=3e8 #m/s
e=1.6e-19
Eg=1.85 #eV
#Wavelenght emitted
lam=(h*c)/(Eg*e)
lamarm=lam*1e10
print 'Wavelenght emitted:' ,round(lamarm),'A'