# variable declaration
V_CC=15.0; #supply voltage
R_C=1.0*10**3; #resistance in ohm
R_1=20.0*10**3; #resistance in ohm
R_2=5.1*10**3; #resistance in ohm
R_3=5.1*10**3; #resistance in ohm
R_4=15.0*10**3; #resistance in ohm
R_E_1=47.0; #resistance in ohm
R_E_2=330.0; #resistance in ohm
R_E_3=16.0; #resistance in ohm
R_L=16.0; #SPEAKER IS THE LOAD;
B_ac_Q1=200.0; #B_ac value
B_ac_Q2=B_ac_Q1; #B_ac value
B_ac_Q3=50.0; #B_ac value
#calculation
#R_c1=R_C||[R_3||R_4||B_acQ2*B_ac_Q3*(R_E_3||R_L)] is ac collector resistance
R=(R_E_3*R_L)/(R_E_3+R_L); #calculating resistance
R=B_ac_Q2*B_ac_Q3*R;
R=(R*R_4)/(R+R_4); #calculating resistance
R=(R*R_3)/(R+R_3);
R_c1=(R*R_C)/(R_C+R); #ac collector resistance
#V_B=((R_2||(B_acQ1*(R_E_1+R_E_2)))/(R_1+(R_2||B_acQ1*(R_E_1+R_E_2))))*V_CC;
#This is the base voltage;
#LET R=(R_2||(B_acQ1*(R_E_1+R_E_2)))
R=(R_2*B_ac_Q1*(R_E_1+R_E_2))/(R_2+B_ac_Q1*(R_E_1+R_E_2));
V_B=R*V_CC/(R_1+R);
I_E=(V_B-0.7)/(R_E_1+R_E_2);
r_e_Q1=25.0*10**-3/I_E;
A_v1=(-1)*(R_c1)/(R_E_1+r_e_Q1); #voltage gain of 1st stage
#total input resistance of 1st stage is
#R_in_tot_1=R_1||R_2||B_ac_Q1*(R_E_1+r_e_Q1);
xt=R_E_1+r_e_Q1
yt=R_2*B_ac_Q1
R_in_tot_1=(R_1*(yt*(xt)/(R_2+B_ac_Q1*(xt))))/(R_1+(yt*(xt)/(yt*(xt))));
A_v2=1; #gain of darlington voltage-follower
A_v_tot=A_v1*A_v2; #total gain
A_p=(A_v_tot**2)*(R_in_tot_1/R_L); #power gain
A_p=42508.68
#result
print "Voltage gain= %.2f" %A_v_tot
print "Power gain= %.2f" %A_p
# variable declaration
V_in=176.0*10**-3;
R_in=2.9*10**3; #total input resistance from previous question
A_p=42429.0; #power gain from previous question
V_CC=15.0;
I_CC=0.6; #emitter current
#calculation
P_in=V_in**2/R_in; #input power
P_out=P_in*A_p;
P_DC=I_CC*V_CC;
eff=P_out/P_DC; #efficiency
#result
print "efficiency= %.2f" %eff
# variable declaration
V_CC=20.00; #supply voltage
R_L=16.0; #load resistance
#calculation
V_out_peak=V_CC; #calculate peak op voltage
I_out_peak=V_CC/R_L; #calculate peak op current
#result
print "ideal maximum peak output voltage = %.2f volts" %V_out_peak
print "ideal maximum current =%.2f amperes" %I_out_peak
# variable declaration
V_CC=20.0; #supply volatge
R_L=16.0; #load resistance
#calculation
V_out_peak=V_CC/2;
I_out_peak=V_out_peak/R_L;
#result
print "ideal maximum output peak voltage = %.2f volts" %V_out_peak
print "ideal maximum current = %.2f amperes" %I_out_peak
import math
# variable declaration
V_CC=20.0; #supply voltage
R_L=8.0; #load resistance
B_ac=50.0; #B_ac value
r_e=6.0; #internal resistance
#calculation
V_out_peak=V_CC/2;
V_CEQ=V_out_peak;
I_out_peak=V_CEQ/R_L;
I_c_sat=I_out_peak;
P_out=0.25*I_c_sat*V_CC;
P_DC=(I_c_sat*V_CC)/math.pi;
R_in=B_ac*(r_e+R_L);
#result
print "maximum ac output power = %.2f Watts" %P_out
print "maximum DC output power = %.2f Watts" %P_DC
print "input resistance = %.2f ohms" %R_in
import math
# variable declaration
V_DD=24.0;
V_in=100*10**-3; #ip volatge
R1=440.0; #resistance in ohm
R2=5.1*10**3; #resistance in ohm
R3=100*10**3; #resistance in ohm
R4=10**3; #resistance in ohm
R5=100.0; #resistance in ohm
R7=15*10**3; #resistance in ohm
R_L=33.0; #load resistance in ohm
V_TH_Q1=2.0; # V-TH value
V_TH_Q2=-2.0;
#calculation
I_R1=(V_DD-(-V_DD))/(R1+R2+R3);
V_B=V_DD-I_R1*(R1+R2); #BASE VOLTAGE
V_E=V_B+0.7; #EMITTER VOLTAGE
I_E=(V_DD-V_E)/(R4+R5); #EMITTER CURRENT
V_R6=V_TH_Q1-V_TH_Q2; #VOLTAGE DROP ACROSS R6
I_R6=I_E;
R6=V_R6/I_R6;
r_e=25*10**-3/I_E; #UNBYPASSED EMITTER RESISTANCE
A_v=R7/(R5+r_e); #VOLTAGE GAIN
V_out=A_v*V_in;
P_L=V_out**2/R_L;
#result
print "value of resistance R6 = %.2d ohms for AB operation" %R6
print "power across load = %.2f watts"%P_L
import math
# variable declaration
f=200.0*10**3; #frequency in hertz
I_c_sat=100.0*10**-3; #saturation current
V_ce_sat=0.2; #sat voltage
t_on=1.0*10**-6; #on time
#calculation
T=1/f; #time period of signal
P_D_avg=(t_on/T)*I_c_sat*V_ce_sat; #power dissipation
#result
print "average power dissipation =%.3f Watts" %P_D_avg
import math
# variable declaration
P_D_avg=4.0*10**-3; #power dissipation
V_CC=24.0; #supply voltage
R_c=100.0; #resistance in ohm
#calculation
P_out=(0.5*V_CC**2)/R_c; #output power
n=(P_out)/(P_out+P_D_avg); #n is efficiency
#result
print "efficiency=%.4f" %n