from __future__ import division
#Given data
Alpha_o = 0.978 # unit less
f_Alpha = 2.5 # in MHz
f_Beta = (1-Alpha_o)*f_Alpha # in MHz
print "The value of f_Beta = %0.3f MHz " %f_Beta
Beta = (0.707*Alpha_o)/(1-Alpha_o) # unit less
print "The value of Beta = %0.2f " %Beta
from numpy import pi
#Given data
C =0.15 # in µF
C = C * 10**-6 # in F
R = 7.5 # in k ohm
R = R * 10**3 # in ohm
f1 = 1/(2*pi*R*C) # in Hz
print "The cutoff frequency = %0.1f Hz " %f1
#Given data
R_S = 1 # in k ohm
R1 = 20 # in k ohm
R2 = 10 # in k ohm
R_C = 2 # in k ohm
R_E = 2 # in k ohm
R_L = 2 # in k ohm
V_BE = 0.7 # in V
V_T = 26*10**-3 # in V
Beta = 100 # unite less
V_CC = 15 # in V
Cin = 10 # in µF
C_E = 20 # in µF
Cout = 1 # in µF
V_B = R2/(R1+R2) *V_CC # in V
#I_E = V_E/R_E = (V_B-V_BE)/(R_E*10**3) # in A
I_E = (V_B-V_BE)/(R_E*10**3) # in A
r_e = V_T/I_E # in ohm
r_e= r_e*10**-3 # in k ohm
# Av = Vout/Vin = ( (-(R_C*R_L)/(R_C+R_L))/r_e )
Av = ( (-(R_C*R_L)/(R_C+R_L))/(r_e) )
Rin = (R1*R2*Beta*r_e)/((R1*R2)+(R2*Beta*r_e)+(Beta*r_e*R1)) # in k ohm
Zin = Rin # in k ohm
# Vin = (Rin/(Rin+R_S))*V_S
Vin_by_V_S = Rin/(Rin+R_S)
Avi = Av*Vin_by_V_S # unite less
print "The voltage gain = %0.1f" %Avi
f_Li = 1/( 2*pi*(R_S+Rin)*10**3*Cin*10**-6 ) # in Hz
print "The lower cutoff frequency = %0.1f Hz " %f_Li
# Note: The wrong value is putted of Rin to evaluating the value of f_Li, So there is some difference between
# coding and the answer of the book.
#Given data
Cin = 0.02*10**-6 # in F
Cout = 0.47*10**-6 # in F
Cs = 2.2*10**-6 # in F
Rsignal = 12*10**3 # in ohm
R_G = 2*10**6 # in ohm
R_D = 1.5*10**3 # in ohm
Rout = 1.5*10**3 # in ohm
Rs = 2*10**3 # in ohm
R_L = 2.7*10**3 # in ohm
I_DSS = 15*10**-3 # in A
V_P = -4 # in V
V_GSQ = -2 # in V
V_DD = 30 # in V
g_mo = (-2*I_DSS)/V_P # in S
g_m = g_mo * (1-(V_GSQ/V_P)) # in S
fLi = 1/( 2*pi*(Rsignal+R_G)*Cin ) # in Hz
fLo = 1/( 2*pi*(Rout+R_L)*Cout ) # in Hz
Req = (Rs*(1/g_m))/(Rs+(1/g_m)) # in ohm
fLs = 1/(2*pi*Req*Cs) # in Hz
print "The lower cutoff frequency = %0.1f Hz " %fLs
#Given data
Ccb = 5 # in pF
Cbe = 12 # in pF
h_fe = 100 # unite less
h_ie = 1.5 # in k ohm
R_C = 12 # in k ohm
Av = (-h_fe/h_ie)*R_C
Cin = Cbe + (1-Av)*Ccb # in pF
print "The input capacitance = %0.f pF " %Cin
#Given data
V_DD = 10 # in V
Cds = 0.5*10**-12 # in F
Cgs = 5*10**-12 # in F
Cgd = 4*10**-12 # in F
R_D = 2*10**3 # in ohm
I_DSS = 10*10**-3 # in A
V_P = -4 # in V
V_GSQ = -2 # in V
g_mo = (-2*I_DSS)/V_P # in S
g_m = g_mo * (1-(V_GSQ/V_P)) # in S
Av = -R_D*g_m # circuit mid-frequency gain
# Miller capacitance
C_M = (1-Av)*Cgd # in F
C_M= C_M*10**12 # in pF
print "The miller capacitance = %0.f pF " %C_M
#Given data
I_C = 1 # in mA
V_T = 26 # in mV
g_m = I_C/V_T # in S
print "The value of g_m = %0.2f mS " %(g_m*10**3)
h_fe = 224 # unit less
r_b_desh_e= h_fe/g_m # in ohm
print "The value of r_b'e = %0.3f k ohm " %(r_b_desh_e*10**-3)
h_ie = 6 # in k ohm
h_ie = h_ie *10**3 # in ohm
r_b_desh_b= h_ie - r_b_desh_e # in ohm
print "The value r_b'b = %0.f ohm " %r_b_desh_b
fT = 80 # in MHz
fT = fT * 10**6 # in Hz
C_b_desh_c = 12 # in pF
C_b_desh_c = C_b_desh_c* 10**-12 # in F
C_b_desh_e= (g_m/(2*pi*fT)) - C_b_desh_c # in F
C_b_desh_e=C_b_desh_e*10**12 # in pF
print "The value of C_b'e = %0.1f pF " %C_b_desh_e
#Given data
I_C = 10 # in mA
I_C = I_C * 10**-3 # in A
V_CE = 10 # in V
h_ie = 500 # in ohm
h_oe = 4*10**-5 # in A/V
h_fe = 100 # unit less
h_re = 10**-4 # unit less
V_T = 26 # in mV
V_T = V_T * 10**-3 # in V
g_m = I_C/V_T # in S
g_m= g_m*10**3 # in mS
print "The value of g_m = %0.1f mS " %g_m
g_m= g_m*10**-3 # in S
r_b_desh_e = h_fe/g_m # in ohm
print "The value of r_b'e = %0.f ohm " %r_b_desh_e
r_b_desh_b = h_ie - r_b_desh_e # in ohm
print "The value of r_b'b = %0.f ohm " %r_b_desh_b
r_b_desh_c = r_b_desh_e/h_re # in ohm
r_b_desh_c= r_b_desh_c *10**-6 # in M ohm
print "The value of r_b'c = %0.1f Mohm " %r_b_desh_c
r_b_desh_c= r_b_desh_c *10**6 # in ohm
g_b_desh_c = 1/r_b_desh_c # unit less
g_ce = h_oe - (1+h_fe)*g_b_desh_c # in S
print "The value of g_ce = %0.2e S " %g_ce
Cob = 3 # in pF
Cbdasc = Cob # in pF
print "The value of C_b'c = %0.f pF " %Cbdasc
fT = 50 # in MHz
fT = fT * 10**6 # in Hz
Cbdase = (g_m/(2*pi*fT))-Cbdasc * 10**-12 # in F
Cbdase= Cbdase *10**12 # in pF
print "The value of C_b'e = %0.f pF " %Cbdase
from math import log
#Given data
V_CC = 12 # in V
V_EE = V_CC # in V
I = 1 # in mA
I = I * 10**-3 # in A
R_B = 120 # in k ohm
R_B = R_B * 10**3 # in ohm
R_C = 10 # in k ohm
R_C = R_C * 10**3 # in ohm
Rsig = 5 # in k ohm
Rsig = Rsig * 10**3 # in ohm
R_L = 5 # in k ohm
R_L = R_L * 10**3 # in ohm
Beta = 125 # unit less
V_A = 200 # in V
Cmiu = 1 # in pF
Cmiu = Cmiu * 10**-12 # in F
fT = 1000 # in MHz
fT = fT * 10**6 # in Hz
r_x = 50 # in ohm
V_T = 25 # in mV
V_T = V_T * 10**-3 # in V
g_m = I/V_T # in A/V
r_pie = Beta/g_m # in ohm
r_o = V_A/I # in ohm
Cpie = (g_m/(2*pi*fT))-Cmiu # in F
RdasL = (r_o*R_C*R_L)/( (r_o*R_C)+(R_C*R_L)+(R_L*r_o) ) # in ohm
Gm = g_m*RdasL # unit less
R = (R_B*Rsig)/(R_B+Rsig) # in ohm
A_VM = (-R_B/(R_B+Rsig)) * (r_pie/(r_pie+r_x+R)) * Gm
print "The mid band gain = %0.2f " %A_VM
Avm = 20*log(abs(A_VM)) # in dB
Cin = Cpie+Cmiu*(1+Gm) # in F
Rdassig = (r_pie*(r_x+R))/(r_pie+(r_x+R)) # in ohm
f2 = 1/( 2*pi*Cin*Rdassig) # in Hz
f2 = f2 * 10**-3 # in kHz
print "The upper 3-dB frequency = %0.1f kHz " %f2
#Given data
R_G = 3.9*10**6 # in ohm
R_L = 18*10**3 # in ohm
R_D = R_L # in ohm
g_m = 2*10**-3 # in A/V
r_o = 250*10**3 # in ohm
Cgs = 1*10**-12 # in F
Cgd = 0.25*10**-12 # in F
Rsig = 50*10**3 # in ohm
A_VM =-R_G/(R_G+Rsig)*g_m*r_o*R_D*R_L/(r_o*R_D+R_D*R_L+R_L*r_o)
print "The midband gain = %0.1f " %A_VM
RdasL = (r_o*R_D*R_L)/( (r_o*R_D) +(R_D*R_L)+(R_L*r_o) ) # in ohm
Ceq = (1 + g_m*RdasL)*Cgd # in F
Cin = Cgs+Ceq # in F
f2 = 1/( 2*pi*Cin*( (Rsig*R_G)/(Rsig+R_G) ) ) # in Hz
f2 = f2 * 10**-3 # in kHz
print "The upper 3dB frequency = %0.1f kHz " %f2