import math
#initialisation of variables
Rs=0 #in V
hfe=50.0 #in K
hie=1.1 #in K
hre=0 #in K
hoe=0 #in K
print('We first calculate the effective load Rl1 at the first calculator')
r1=10 #in K
r2=47 #in K
r3=33.0 #in K
r4=1+0.1 #in K
#Calculations
Rl1=(r1*r2*r3*r4)/((r1*r2*r3)+(r1*r2*r4)+(r1*r3*r4)+(r2*r3*r4))
print("Rl1= %.2f K " %Rl1)
print('Similarly for 2nd Transistor')
R1=0.1 #in K
R2=4.7 #in K
Rc1=R1+R2
Rc2=4.7 #in K
Rl2=(Rc1*Rc2)/(Rc1+Rc2)
print("Rl2= %.2f K" %Rl2)
Re=(R1*R2)/(R1+R2)
print('Voltage Gain of Transistor Q1')
Av1 = -(hfe*Rl1)/(hie+((1+hfe)*Re))
print("Av1= %.2f v " %Av1)
print('Voltage Gain of Transistor Q2')
Av2=-(hfe*Rl2)/hie
print("Av2= %.2f v " %Av2)
print('Voltage Gain of two transistors in cascade without feedback')
Av=Av1*Av2
print("Av= %.2f v " %Av)
B=R1/(R1+R2)#beta which is feedback
D=1+(B*Av)
Avf=Av/D
print("Avf= %.2f v " %Avf)
print('Input resistance without external feedback')
Ri=hie+(1+hfe)*Re
print("Ri= %.2f K " %Ri)
Rif=Ri*D
#Results
print("Rif= %.2f K " %Rif)
Ro=Rl2
Rof=Ro/D*1000
print("Rof= %.2f ohm" %Rof)
import math
#initialisation of variables
Gmf=-1 #Transconductance in mA/V
D=50.0 #Desensivity
Avf=-4 #Voltage Gain
Rs=1.0 #in K
hfe=150.0
Vt=0.026 #in V
#Calculations
Gm=Gmf*D
print("Gm= %.2f mA/V " %Gm)
#B=-Re, D = 1+B*Gm = 1-B*Gm
Re=(1.0-D)/Gm #in K
#Results
print("Re= %.2f K " %Re)
import math
#initialisation of variables
Rc1=3#in K
Rc2=0.5#in K
Re=0.05#in K
Rs=1.2#in K
hfe=50.0
hie=1.1#in K
hre=0
hoe=0
R=Rs
#Calculations
#Ai=-Ic2/Is=-(Ic2/Ib2)*(Ib2/Ic1)*(Ic1/Ib1)*(Ib1/Is)
# -Ic2/Ib2 =- hfe = -50
# Ic1/Ib1 = hfe
#Let Ib2/Ic1 = k
Ri2= hie+((1+hfe)*(Re*R/(Re+R)))
k=-Rc1/(Rc1+Ri2)
r= Rs*(Rs+Re)/(Rs+R+Re)
#Let Ib1/Is = l
l=r/(r+hie)
Ai=(-hfe)*(k)*(hfe)*(l)
B=Re/(Re+R)#beta
D=1+(B*Ai)
Aif=Ai/D
Avf=(Aif*Rc2)/Rs
#To find Rif
Ri=(r*hie)/(r+hie)
Rif=Ri/D
#Results
print("The value of Rif= %.2f ohm " %(Rif*1000))
import math
#initialisation of variables
Gmf=-1 #Transconductance in mA/V
D=50.0 #Desensivity
Avf=-4 #Voltage Gain
Rs=1.0 #in K
hfe=150.0
Vt=0.026 #in V
Gm=Gmf*D
#Calculations
#B=-Re, D = 1+B*Gm = 1-B*Gm
Re=(1-D)/Gm#in K
Rl=Avf/Gmf#in K
# Gm= -hfe/(Rs+hie+Re)
hie= -(hfe/Gm)-Rs-Re
Ri = Rs + hie +Re
Rif = Ri*D
#Results
print("The value of Rif= %.2f K " %Rif)
import math
#initialisation of variables
Gmf=-1 #Transconductance in mA/V
D=50.0 #Desensivity
Avf=-4 #Voltage Gain
Rs=1.0 #in K
hfe=150.0
Vt=0.026 #in V
Gm=Gmf*D
#Calculations
#B=-Re, D = 1+B*Gm = 1-B*Gm
Re=(1-D)/Gm#in K
Rl=Avf/Gmf#in K
# Gm= -hfe/(Rs+hie+Re)
hie= -(hfe/Gm)-Rs-Re
Ri = Rs + hie +Re
Rif = Ri*D
Ic=(hfe*Vt)/hie
#Results
print("Quiscent Collector Current = %.2f mA " %Ic)
import math
#initialisation of variables
Rc1=3#in K
Rc2=0.5#in K
Re=0.05#in K
Rs=1.2#in K
hfe=50.0
hie=1.1#in K
hre=0
hoe=0
R=Rs
#Calculations
#Ai=-Ic2/Is=-(Ic2/Ib2)*(Ib2/Ic1)*(Ic1/Ib1)*(Ib1/Is)
# -Ic2/Ib2 =- hfe = -50
# Ic1/Ib1 = hfe
#Let Ib2/Ic1 = k
Ri2= hie + ((1+hfe)*(Re*R/(Re+R)))
k=-Rc1/(Rc1+Ri2)
r= Rs*(Rs+Re)/(Rs+R+Re)
#Let Ib1/Is = l
l=r/(r+hie)
Ai=(-hfe)*(k)*(hfe)*(l)
print("The value of Ai = %.2f " %Ai)
B=Re/(Re+R)#beta
D=1+(B*Ai)
Aif=Ai/D
print("The value of Aif = %.2f v " %Aif)
Avf=(Aif*Rc2)/Rs
#Results
print("The value of Avf = %.2f v " %Avf)
import math
#initialisation of variables
Rc1=3.0 #in K
Rc2=0.5 #in K
Re=0.05 #in K
Rs=1.2 #in K
hfe=50.0
hie=1.1 #in K
hre=0
hoe=0
R=Rs
#Calculations
#Ai=-Ic2/Is=-(Ic2/Ib2)*(Ib2/Ic1)*(Ic1/Ib1)*(Ib1/Is)
# -Ic2/Ib2 =- hfe = -50
# Ic1/Ib1 = hfe
#Let Ib2/Ic1 = k
Ri2= hie + ((1+hfe)*(Re*R/(Re+R)))
k=-Rc1/(Rc1+Ri2)
r= Rs*(Rs+Re)/(Rs+R+Re)
#Let Ib1/Is = l
l=r/(r+hie)
Ai=(-hfe)*(k)*(hfe)*(l)
B=Re/(Re+R)#beta
D=1+(B*Ai)
Aif=Ai/D
Avf=(Aif*Rc2)/Rs
#To find Rif
Ri=(r*hie)/(r+hie)
Rif=Ri/D
#Results
print("The value of Rif = %.2f ohm " %(Rif*1000))
import math
#initialisation of variables
Rc1=3.0 #in K
Rc2=0.5 #in K
Re=0.05 #in K
Rs=1.2 #in K
hfe=50.0
hie=1.1 #in K
hre=0
hoe=0
R=Rs
#Calculations
#Ai=-Ic2/Is=-(Ic2/Ib2)*(Ib2/Ic1)*(Ic1/Ib1)*(Ib1/Is)
# -Ic2/Ib2 =- hfe = -50
# Ic1/Ib1 = hfe
#Let Ib2/Ic1 = k
Ri2= hie + ((1+hfe)*(Re*R/(Re+R)))
k=-Rc1/(Rc1+Ri2)
r= Rs*(Rs+Re)/(Rs+R+Re)
#Let Ib1/Is = l
l=r/(r+hie)
Ai=(-hfe)*(k)*(hfe)*(l)
B=Re/(Re+R)#beta
D=1+(B*Ai)
Aif=Ai/D
Avf=(Aif*Rc2)/Rs
Ri=(r*hie)/(r+hie)
Rif=Ri/D
rif=(Rif*Rs)/(Rs-Rif)
#Results
print("Resistance with feedback seen by voltage source is %.2f K " %(rif+Rs))
import math
#initialisation of variables
Rc1=3.0 #in K
Rc2=0.5 #in K
Re=0.05 #in K
Rs=1.2 #in K
hfe=50.0
hie=1.1 #in K
hre=0
hoe=0
R=Rs
#Calculations
#Ai=-Ic2/Is=-(Ic2/Ib2)*(Ib2/Ic1)*(Ic1/Ib1)*(Ib1/Is)
# -Ic2/Ib2 =- hfe = -50
# Ic1/Ib1 = hfe
#Let Ib2/Ic1 = k
Ri2= hie + ((1+hfe)*(Re*R/(Re+R)))
k=-Rc1/(Rc1+Ri2)
r= Rs*(Rs+Re)/(Rs+R+Re)
#Let Ib1/Is = l
l=r/(r+hie)
Ai=(-hfe)*(k)*(hfe)*(l)
B=Re/(Re+R)#beta
D=1+(B*Ai)
Aif=Ai/D
Avf=(Aif*Rc2)/Rs
Rof=(Avf*Rs)/Aif
#Results
print("Output Resistance = %.2f K " %Rof)
import math
#initialisation of variables
Rc=4#in K
r=40#in K
Rs=10#in K
hie=1.1#in K
hfe=50
hre=0
hoe=0
#Calculations
#Required Formulae
rc=(Rc*r)/(Rc+r)
R=(Rs*r)/(Rs+r)
Rm=-(hfe*rc*R)/(R+hie)
print("The value of Rm = %.2f K " %Rm)
B=-1/r#in mA/V
D=1+(B*Rm)
Rmf=Rm/D
#Avf = Vo/Vs = Vo/(Is*Rs) = Rmf/Rs
Avf=Rmf/Rs
#Results
print("The value of Avf = %.2f v " %Avf)
import math
#initialisation of variables
Rc=4.0 #in K
r=40.0 #in K
Rs=10.0 #in K
hie=1.1 #in K
hfe=50.0
hre=0
hoe=0
#Calculations
#Required Formulae
rc=(Rc*r)/(Rc+r)
R=(Rs*r)/(Rs+r)
Rm=-(hfe*rc*R)/(R+hie)
B=-1.0/r#in mA/V
D=1+(B*Rm)
Rmf=Rm/D
#Avf = Vo/Vs = Vo/(Is*Rs) = Rmf/Rs
Avf=Rmf/Rs
Ri = (R*hie)/(R+hie)
Rif=Ri/D
#Results
print("The value of Rif = %.2f v " %Rif)
import math
#initialisation of variables
Rc=4.0 #in K
r=40.0 #in K
Rs=10.0 #in K
hie=1.1 #in K
hfe=50.0
hre=0
hoe=0
#Calculations
#Required Formulae
rc=(Rc*r)/(Rc+r)
R=(Rs*r)/(Rs+r)
Rm=-(hfe*rc*R)/(R+hie)
print("The value of Rm = %.2f v " %Rm)
B=-1/r#in mA/V
D=1+(B*Rm)
Rmf=Rm/D
#Avf = Vo/Vs = Vo/(Is*Rs) = Rmf/Rs
Avf=Rmf/Rs
Ri = (R*hie)/(R+hie)
Rif=Ri/D
#If the input resistance looking to the right of Rs is rif then Rif=(rif*Rs)/(rif+Rs)
rif=(Rif*Rs)/(Rs-Rif)
print("The impedence seen by the voltage source=Rif = %.2f K " %(Rs+rif))
Ro=40.0 #in K
r=40.0 #in K
Rm = -(hfe*r*R)/(R+hie)
Rof=Ro/(1+(B*Rm))
#We are writting Rof' = rof
rof=(Rof*Rc)/(Rof+Rc)
#Results
print("The value of rof = %.2f K " %rof)