#Variable Declaration:
Vcc=5.0 #voltage Vcc in volt
Vbeon=0.6 #Voltage Vbeon in volt
Beta=150.0 #gain
Io=100.0*10**-6 #output current in amperes
#Calculations:
Iref=Io*(1+ 2/Beta) #calculating reference current
Iref=Iref*10**6 #calculating reference current
R=(Vcc-Vbeon)/Iref #Calculating value of resistance
R=R*1000.0 #Calculating value of resistance
#Results:
print("Iref= %.2f uA"% Iref)
print("\nResistance= %.2f kohm"% R)
#Variable Declarations:
Vbe=0.7 #voltage Vbe in volt
Vcc=12.0 #voltage Vcc in volt
Rc1=1000.0 #collector resistance in ohm
Rc2=330.0 #collector resistance in ohm
#Calculations:
Iref=(Vcc-Vbe)/Rc1 #calculating reference current
I0=Iref #Output current is equal to Reference current
V0=Vcc-Rc2*I0 #Calculating output volatge
Iref=Iref/10**-3 #calculating reference current
#Results:
print("Iref= %.1f mA"%Iref)
print("\nV0= %.3f V"%V0)
#Variable Declaration
Vbe=0.6 #Voltage Vbe in volt
Vz=4.7 #Zener voltage in volt
Re=1000.0 #Emitter resistance in ohm
#Calculations:
Vre=Vz-Vbe #Calculating voltage acrross emitter resistance
I=(Vre)/Re #Calculating output current
I=I/10**-3 #Calculating output current
#Results
print("I=%.1f mA"%I)
#Variable Declaration:
import math
Vcc=20.0 #Vcc in volt
R1=19300.0 #resistance in ohm
Vbe=0.7 #Vbe voltage in Volt
Ic2=0.000005 #current in amperes
Vt=0.026 # Vt voltage in volt
#Calculations:
Ic1=(Vcc-Vbe)/R1 #Calculating current through transistor Q1
R2=(Vt/Ic2)*math.log(Ic1/Ic2) #Calculating value of R2 for desired current through transistor Q2
Ic1=Ic1/10**-3 #Calculating current through transistor Q1
R2=R2/10**3 #Calculating value of R2 for desired current through transistor Q2
#Results:
print("Ic1= %d mA"%Ic1)
print("\nR2= %.2f kohm"%R2)
#Variable Declaration:
Beta=100.0 #Gain for transistor
R=20000.0 #Resistance in ohm
Vcc=5.0 #Volatage Vcc in volt
Vbe=0.6 #Voltage Vbe in volt
N=3.0 #Number of multiple current source
#Calculations:
Iref=(Vcc-Vbe)/R #Calculating reference current
Ic=Iref*(1+ 4/Beta) #Calculating current through transistor Q
Ic1=Iref*(Beta)/(Beta+N+1) #Calculating current through transistor Q1
Ic2=Iref*(Beta)/(Beta+N+1) #Calculating current through transistor Q2
Ic3=Iref*(Beta)/(Beta+N+1) #Calculating current through transistor Q3
Iref=Iref/10**-3 #Calculating Reference current
Ic1=Ic1/10**-3 #Calculating current through transistor Q1
#Results:
print("Iref= %.2f mA"%Iref)
print("\nIc1=Ic2=Ic3= %.3f mA"%Ic1)
#Variable Declaration:
Iref=0.25*10**-3 #Reference current in amperes
Io=0.2*10**-3 #Outpyt current in amperes
kn=20*10**-6 #Transconductance in ampere per volt square
Vth=1.0 #Threshold voltage in volt
Vgs2=1.752 #Voltage Vgs2 in volt
lamb=0.0 #Channel length modulation parameter
Vdd=5.0 #Voltge Vdd in volt
Vss=0.0 #voltage Vss in volt
#Calculations:
wbyltwo=Io/(kn*(Vgs2-Vth)**2) #calculating width by length 2 ratio
Vdssat=Vgs2-Vth #Calculating voltage Vdssat
Vgs1=Vgs2 #Volage Vgs1 is eqaul to Vgs2
wbylone=Iref/(kn*(Vgs2-Vth)**2) #Calculating width by length 1 ratio
Vgs3=Vdd-Vss-Vgs1 #Calculating Vgs3
wbylthr=Iref/(kn*(Vgs3-Vth)**2) #calculating width by length 3 ratio
#Results:
print("W/L2= %.1f"%wbyltwo)
print("\nVds(sat)= %.3f V"%Vdssat)
print("\nW/L1= %.1f"%wbylone)
print("\nVgs3= %.3f V"%Vgs3)
print("\nW/L3= %.2f"% wbylthr)
#Variable Declaration:
cmrra=1000.0 #common mode rejection ratio
cmrrb=10000.0 #common mode rejection ratio
v1a=100.0*10**-6 #input voltage in volt
v2a=-100.0*10**-6 #input voltage in volt
v1b=1100.0*10**-6 #input voltage in volt
v2b=900.0*10**-6 #input voltage in volt
#Calculations
#for first set
vida=v1a-v2a #Calculating differential volatge
vcma=(v1a+v2a)/2 #calculating common mode voltage
vic=0.0 #Calculating common mode voltage
voa=vida*(1+vic/(cmrra*vida)) #Calculating Output voltage
voa=voa*10**6 #Calculating output volatge
# for second set
vidb=v1b-v2b #Calculating differential volatge
vic=(v1b+v2b)/2 #calculating common mode voltage
vob=vidb*(1+vic/(cmrrb*vidb)) #Calculating Output voltage
vob=vob*10**6 #Calculating Output voltage
#Results:
print("\nVo for second set= %.1f uV"%vob)
print("Vo for first set= %.1f uV"% voa)
#answer in textbook is wrong
#Variable Declaration:
Beta=100.0 #Gain
Vee=15.0 #Voltage Vee in volt
Vcc=15.0 #Voltage Vcc in volt
Vbe=0.7 #Voltage Vbe in volt
Re=65.0*10**3 #Resistance in ohm
Rc=65.0*10**3 #Resistance in ohm
alpha=100.0/101.0 #Gain
Ve=-0.7 #Voltage Ve in volt
#Calculations:
Ie=(Vee-Vbe)/(2*Re) #Calculating emitter current
Ic=alpha*Ie #Calculating collector current
Ib=Ic/Beta #Calculating base current
Vc=Vcc-Ic*Rc #Calculating collector volatge
Vce=Vc-Ve #Calculating voltage between collector and emitter
Ie=Ie*10**6 #Calculating emitter current
Ic=Ic*10**6 #Calculating collector current
Ib=Ib*10**6 #Calculating base current
# by approximating, because Vee>>Vbe
Ieapprox=Vee/(2*Re) #calculating emitter current by approximation
Ieapprox=Ieapprox*10**6 #calculating emitter current by approximation
#Results:
print('Ie= %.1f uA'%Ie)
print('\nIc= %.1f uA'%Ic)
print('\nIb= %.3f uA'%Ib)
print('\nVc= %.3f V'%Vc)
print('\nVce= %.3f V'%Vce)
print('\nIe (approx)= %.2f uA'%Ieapprox)
#Variable Declaration:
import math
Vdd=12.0 #Voltage Vdd in volt
Vss=-12.0 #Voltage Vss in volt
Iss=175.0*10**-6 #Current Iss in amperes
Rd=65.0*10**3 #resistance Rd in ohm
kn=3.0*10**-3 #Transconductance
Vth=1.0 #Voltage Vth in volt
#Calculations:
Ids=Iss/2.0 #Calculating Ids
Vgs=Vth + math.sqrt(Iss/kn) #Calculating Vgs
Vds = Vdd- Ids*Rd + Vgs #Calculating Vds
#Requirement for saturation
Vicmax= Vdd - Ids*Rd + Vth #Calculating Vicmax
Ids=Ids*10**6 #Calculating Ids
#Results:
print('\nIds=%.1f uA'% Ids)
print('\nVgs=%.3f V'%Vgs)
print('\nVds=%.2f V'% Vds)
print('\nVicmax=%.2f V'% Vicmax)
print('\nRequirement of saturation for M1 \nfor non-zero Vic necessiates Vic <= 7.312 V')