Vin=50 #input voltage(mV)
Rf=3.9 #feedback path resistance Rf (KOhm)
R1=0.1 #inverting input resistance R1(KOhm)
AVOL=100000 #open loop voltage gain
B=R1/(Rf+R1) #feedback fraction
Av=B**-1 #closed loop voltage gain
Err=100/(1+AVOL*B) #percent error (%)
Av1=Av-((Av/100)*Err) #closed loop voltage gain1
Av2=AVOL/(1+AVOL*B) #closed loop voltage gain2
print 'closed loop voltage gain by approach 1 = ',round(Av1,2)
print 'closed loop voltage gain by approach 2 = ',round(Av2,2)
Vin=50 #input voltage(mV)
Rf=3.9*10**3 #feedback path resistance Rf (Ohm)
R1=100 #inverting input resistance R1(Ohm)
AVOL=100000 #open loop voltage gain
B=0.025 #feedback fraction
Rin=2*10**6 #open loop input resistance(Ohm)
RCM=200*10**6 #common mode input resistance(Ohm)
Zin_CL=(1+(AVOL*B))*Rin #closed loop input impedance(Ohm)
Zin_CL1=RCM*Zin_CL/(RCM+Zin_CL) #closed loop input impedance(Ohm)
print 'closed loop input impedance Zin(CL) = ',round((Zin_CL1/10**6),2),'MOhm'
Rout=75 #open loop output resistance(Ohm)
AVOL=100000 #open loop voltage gain
B=0.025 #feedback fraction
Zout_CL=Rout/(1+AVOL*B) #closed loop input impedance(Ohm)
print 'closed loop output impedance Zout(CL) = ',round(Zout_CL,2),'Ohm'
THD=7.5 #open loop total harmonic distortion (%)
AVOL=100000 #open loop voltage gain
B=0.025 #feedback fraction
THD_CL=THD/(1+AVOL*B) #closed loop total harmonic distortion (%)
print 'Closed loop total harmonic distortion THD(CL) = ',round(THD_CL,3),'%'
Iin=1 #input current(mA)
Rf=5 #feedback path resistance Rf (KOhm)
Vout=-(Iin*Rf) #Output voltage at 1KHz (Vpp)
print 'Output ac voltage at 1KHz Vout = ',Vout,'Vpp'
Rout=75.0 #open loop output resistance(Ohm)
AVOL=100000 #open loop voltage gain
Rf=5.0*10**3 #feedback path resistance(Ohm)
Zin_CL=Rf/(1+AVOL) #closed loop input impedance(Ohm)
Zout_CL=Rout/(1+AVOL) #closed loop input impedance(Ohm)
print 'closed loop input impedance Zin(CL) = ',round(Zin_CL,2),'Ohm'
print 'closed loop output impedance Zout(CL) = ',round(Zout_CL,5),'Ohm'
Vin=2 #input voltage(Vrms)
RL1=2 #load resistance (KOhm)
R1=1 #inverting input resistance R1(KOhm)
RL2=4 #load resistance(KOhm)
iout=Vin/R1 #output current (mA)
PL1=(iout**2)*RL1 #load power for 2 Ohm (W)
PL2=(iout**2)*RL2 #load power for 4 Ohm (W)
print 'load power for 2 Ohm = ',PL1,'W'
print 'load power for 4 Ohm = ',PL2,'W'
import math
Iin=1.5*10**-3 #input current(mA)
RL1=1 #load resistance (KOhm)
R1=1 #inverting input resistance R1(KOhm)
RL2=2 #load resistance (KOhm)
Rf=1*10**3 #feedback path resistance(Ohm)
Ai=math.ceil(1+(Rf/R1)) #current gain
iout=Iin*Ai #output current (mA)
PL1=(iout**2)*RL1 #load power for 1 Ohm (W)
PL2=(iout**2)*RL2 #load power for 2 Ohm (W)
print 'load power for 2 Ohm = ',round(PL1,2),'W'
print 'load power for 4 Ohm = ',round(PL2,2),'W'
AB=1000 #(1+AvolB) term
f2_OL=160 #open loop bandwidth(Hz)
f2_CL=f2_OL*AB/1000 #closed loop bandwidth(KHz)
print 'closed loop bandwidth f2(CL)= ',f2_CL,'KHZ'
AVOL=250000 #open loop voltage gain
f2_OL=1.2 #open loop bandwidth(Hz)
Av_CL=50 #closed loop voltage gain
f2_CL=f2_OL*AVOL/Av_CL/1000 #closed loop bandwidth(KHz)
print 'closed loop bandwidth for Av(CL) = 50, f2(CL)= ',f2_CL,'KHZ'
AVOL=50000 #open loop voltage gain
f2_OL=14 #open loop bandwidth(Hz)
f2_CL=f2_OL*(1+AVOL)/1000 #closed loop bandwidth(KHz)
print 'closed loop bandwidth f2(CL)= ',f2_CL,'KHZ'
AB=2500 #(1+AvolB) term
f2_OL=20 #open loop bandwidth(Hz)
f2_CL=f2_OL*AB/1000 #closed loop bandwidth(KHz)
print 'closed loop bandwidth f2(CL)= ',f2_CL,'KHZ'
import math
Av_CL=10.0 #voltage gain
Funity=1*10**6 #unity frequency (Hz)
Sr=0.5 #slew rate (V/us)
f2_CL=Funity/Av_CL/1000 #closed loop bandwidth(KHz)
Vp_max=1000*Sr/(2*math.pi*f2_CL) #largest peak output voltage(V)
print 'closed loop bandwidth f2(CL)= ',f2_CL,'KHZ'
print 'largest peak output voltage Vp(max)= ',round(Vp_max,3),'V'