# Variables
Av = 10; #voltage gain
Ri = 1; #kohm
Ro = 10; #ohm
Vs = 2; #V(Sensor voltage)
Rs = 100; #ohm(Sensor Resistance)
RL = 50; #ohm
# Calculations
Vi = Vs*Ri*1000./(Rs+Ri*1000); #V
Vo = Av*Vi*RL/(Ro+RL); #V
# Results
print "Output voltage of amplifier(V) : %.1f"%Vo
# Variables
Av = 10; #voltage gain
Ri = 1; #kohm
Ro = 10; #ohm
Vs = 2; #V(Sensor voltage)
Rs = 100; #ohm(Sensor Resistance)
RL = 50; #ohm
# Calculations
Vi = Vs*Ri*1000./(Rs+Ri*1000); #V
Vo = Av*Vi*RL/(Ro+RL); #V
Av = Vo/Vi; #voltage gain of circuit
# Results
print "Voltage gain of circuit %.2f"%Av
# Variables
Av = 10.; #voltage gain
Ro = 0.; #ohm
Vs = 2.; #V(Sensor voltage)
Rs = 100.; #ohm(Sensor Resistance)
RL = 50.; #ohm
# Calculations
#Vi = Vs*Ri/(Rs+Ri) leads to Vi approximately equals to Vs as Ri = %inf
Vi = Vs; #V
Vo = Av*Vi*RL/(Ro+RL); #V
# Results
print "Output voltage of amplifier(V) %.2f"%Vo
# Variables
VOC = 10; #V(open circuit voltage)
#VOC = source voltage here
R = 1.; #kohm
# Calculations
ISC = VOC/R; #mA
# Results
print "Current generated by the circuit(mA) : %.2f"%ISC
# Variables
Av = 10; #voltage gain
Ri = 1; #kohm
Ro = 10; #ohm
Vs = 2; #V(Sensor voltage)
Rs = 100; #ohm(Sensor Resistance)
RL = 50; #ohm
# Calculations
Vi = Vs*Ri*1000./(Rs+Ri*1000); #V
Vo = Av*Vi*RL/(Ro+RL); #V
Po = Vo**2/RL; #W
# Results
print "Output power(W) : %.2f"%Po
# Variables
Av = 10.; #voltage gain
Ri = 1.; #kohm
Ro = 10.; #ohm
Vs = 2.; #V(Sensor voltage)
Rs = 100.; #ohm(Sensor Resistance)
RL = 50.; #ohm
# Calculations
Vi = Vs*Ri*1000/(Rs+Ri*1000); #V
Vo = Av*Vi*RL/(Ro+RL); #V
Po = Vo**2/RL; #W
Pi = Vi**2/Ri; #mW
Ap = Po*1000/Pi; #Power gain
# Results
print "Power gain : %.f"%Ap
#Answer in the book is wrong.
import math
# Variables
Ap = 1400; #Power gain
# Calculations
Ap_dB = 10*math.log10(Ap); #dB
# Results
print "Power gain(dB) : %.2f"%Ap_dB
import math
# Variables
Ap1 = 5; #Power gain
# Calculations and Results
Ap1_dB = 10*math.log10(Ap1); #dB
print "Power gain of 5 in dB : %.f"%Ap1_dB
Ap2 = 50; #Power gain
Ap2_dB = 10*math.log10(Ap2); #dB
print "Power gain of 50 in dB : %.f "%Ap2_dB
Ap3 = 500; #Power gain
Ap3_dB = 10*math.log10(Ap3); #dB
print "Power gain of 500 in dB : %.f"%Ap3_dB
Av1 = 5; #Voltage gain
Av1_dB = 20*math.log10(Av1); #dB
print "Voltage gain of 5 in dB : %.f"%Av1_dB
Av2 = 50; #Voltage gain
Av2_dB = 20*math.log10(Av2); #dB
print "Voltage gain of 50 in dB : %.f"%Av2_dB
Av3 = 500; #Voltage gain
Av3_dB = 20*math.log10(Av3); #dB
print "Voltage gain of 500 in dB : %.f"%Av3_dB
import math
# Variables
C = 10.; #micro F
R = 1.; #kohm
# Calculations and Results
T = C*10**-6*R*1000; #seconds
print "Time constant(seconds) : %.2f"%T
omega_c = 1/T; #rads/s
print "omega_c(rads/s) : %.2f"%omega_c
fc = 1./2/math.pi/T; #Hz
print "fc(Hz) : %.2f"%fc
import math
#(a)
f = 1; #kHz
n = 1; #no. of octave(above)
f1 = f*2**n; #Hz
print "(a) An octave above 1 kHz (in kHz) = %.2f"%f1
#(b)
f = 10; #Hz
n = 3; #no. of octave(above)
f1 = f*2**n; #Hz
print "(b) Three octave above 10 Hz (in Hz) = %.2f"%f1
#(c)
f = 100.; #Hz
n = 1.; #no. of octave(below)
f1 = f/2**n; #Hz
print "(c) An octave below 100 Hz (in Hz) = %.2f"%f1
#(d)
f = 20; #kHz
n = 1; #no. of decade(above)
f1 = f*10**n; #Hz
print "(d) An decade above 20 Hz (in Hz) = %.2f"%f1
#(e)
f = 1.; #MHz
n = 3; #no. of decade(below)
f1 = f/10**n; #Hz
print "(e) Three decade below 1 MHz (in kHz) = %.2f"%(f1/1000)
#(f)
f = 50; #kHz
n = 2; #no. of decade(above)
f1 = f*10**n; #Hz
print "(f) Two decade above 50 Hz (in kHz) = %.2f"%(f1/1000)
import math
# Variables
C = 10.; #micro F
R = 1.; #kohm
# Calculations and Results
T = C*10**-6*R*1000; #seconds
print "Time constant(seconds) : %.2f"%T
omega_c = 1./T; #rads/s
print "omega_c(rads/s) : %.2f"%omega_c
fc = 1./2/math.pi/T; #Hz
print "fc(Hz) : %.2f"%fc
import math
# Variables
Vs = 2.5; #V
Vn = 1.0; #mV
# Calculations
SNratio = 20*math.log10(Vs/(Vn/100)); #dB
# Results
print "S/N ratio(dB) : %.f"%SNratio
import math
# Variables
G = 100.; #stable voltage gain
A = range(100000,200000+1); #variable gain
# Calculations and Results
B = 1./G; #Unitless
print ("When the gain of amplifier(A) is 100000");
G1 = min(A)/(1+min(A)*B); #overall gain
print "The overall gain(G) is :%.2f"%G1
print ("When the gain of amplifier(A) is 200000");
G2 = max(A)/(1+max(A)*B); #overall gain
print "The overall gain(G) is %.2f"%G2
change = (G2-G1)/G*100; #% Change in gain
print ("Effect of variable gain :");
print "Corresponding to 100%% Change in gain of active amplifier, Change in overall gain is(%%) :%.2f"%change
# Variables
A = 10000.; #stable voltage gain
B = 1/A; #unitless
#For A = 100000; #gain
A = 100000; #gain
# Calculations and Results
G = A/(1+A*B); #overall gain
print "When the gain of amplifier is 100000, Overall gain will be : %.f"%G
A = 200000.; #gain
G = A/(1+A*B); #overall gain
print "When the gain of amplifier is 200000, Overall gain will be : %.f"%G