# Calculate the differential voltage gain, Ad, and the ac output voltage, Vout.
# Given data
Vin = 10*10**-3# # Input voltage=10 mVolts(p-p)
Rc = 10*10**3# # Collector resistance=10 kOhms
Ie = 715.*10**-6# # Emitter current=715 uAmps
re = (25*10**-3)/Ie#
Ad = Rc/(2*re)#
print 'The Differential Voltage Gain =%0.2f'%Ad
Av = Ad
Vo = Av*Vin#
print 'The Ac Output Voltage = %0.2f Volts(p-p)'%Vo
from math import log10
# calculate the common-mode voltage gain, ACM, and the CMRR (dB).
# Given data
Rc = 10*10**3# # Collector resistance=10 kOhms
Re = 10.*10**3# # Emitter resistance=10 kOhms
Ad = 142.86# # Differential gain=142.86
Acm = Rc/(2*Re)#
print 'The Common-Mode Voltage Gain Acm = %0.2f'%Acm
CMRR = 20*log10(Ad/Acm)#
print 'The Commom-Mode Rejection Ratio = %0.2f dB'%CMRR
from math import pi
# Calculate fmax for an op amp that has an Sr of 5 V/us and a peak output voltage of 10 V.
# Given data
Vpk = 10.# # Peak output voltage=10 Volts
Sr = 5./10**-6# # Slew rate=5 V/us
fo = Sr/(2*pi*Vpk)#
print 'The Output Frequency = %0.2e Hertz'%fo
print 'i.e 79.6 kHz'
# calculate the closed-loop voltage gain, Acl, and the output voltage, Vout.
# Given data
Vin = 1.# # Input voltage=1 Volts(p-p)
Rf = 10.*10**3# # Feedback resistance=10 kOhms
Ri = 1.*10**3# # Input resistance=1 kOhms
Acl = -(Rf/Ri)#
print 'The Closed-Loop Voltage Gain Acl =%0.2f'%Acl
Vo = -Vin*Acl#
print 'The Output Voltage = %0.2f Volts(p-p)'%Vo
print 'The -ve sign indicates that input and output voltages are 180° out-of-phase'
#If Avol equals 100,000, calculate the value of Vid.
# Given data
Avol = 100000.# # Open loop voltage gain=100,000
Vo = 10.# # Output voltage=10 Volts(p-p)
Vid = Vo/Avol#
print 'The Differential Input Voltage = %0.2e Volts(p-p)'%Vid
print 'i.e 100 uVolts(p-p)'
# calculate Zin and Zout(CL). Assume AVOL is 100,000 and Zout(OL) is 75 Ohms.
# Given data
Avol = 100000.# # Open loop voltage gain=100,000
Rf = 10.*10**3# # Feedback resistance=10 kOhms
Ri = 1.*10**3# # Input resistance=1 kOhms
Zool = 75.# # Output impedence (open-loop)=75 Ohms
Zi = Ri#
print 'The Input Impedence = %0.2e Ohms'%Zi
print 'i.e 1 kOhms'
Beta = Ri/(Ri+Rf)#
A = Avol*Beta#
Zocl = Zool/(1+A)#
print 'The Closed Loop Output Impedence = %0.2f Ohms'%Zocl
from math import pi
# Calculate the 5-V power bandwidth.
# Given data
Vo = 10.# # Output voltage=10 Volts(p-p)
Sr = 0.5/10**-6# # Slew rate=0.5 V/us
Vpk = Vo/2#
fo = Sr/(2*pi*Vpk)#
print 'The Output Frequency = %0.2e Hertz'%fo
print 'i.e 15.915 kHz'
# Calculate the closed-loop voltage gain, Acl, and the output voltage, Vout.
# Given data
Vin = 1# # Input voltage=1 Volts(p-p)
Rf = 10.*10**3# # Feedback resistance=10 kOhms
Ri = 1.*10**3# # Input resistance=1 kOhms
Acl = 1+(Rf/Ri)#
print 'The Closed-Loop Voltage Gain Acl =%0.2f'%Acl
Vo = Vin*Acl#
print 'The Output Voltage = %0.2f Volts(p-p)'%Vo
# Calculate Zin(CL) and Zout(CL). Assume Rin is 2 MOhms, Avol is 100,000, and Zout(OL) is 75 Ohms.
# Given data
Avol = 100000.# # Open loop voltage gain=100,000
Ri = 2.*10**6# # Input resistance=2 MOhms
B = 0.0909# # Beta=0.0909
Zool = 75.# # Output impedence (open-loop)=75 Ohms
Zicl = Ri*(1+Avol*B)#
print 'The Input Impedence Closed-Loop = %0.2e Ohms'%Zicl
print 'i.e 18 GOhms'
A = Avol*B#
Zocl = Zool/(1+A)#
print 'The Closed-Loop Output Impedence = %0.2f Ohms'%Zocl
# Assume Rin is 2 MOhms, Avol is 100,000, and Zout(OL) is 75 Ohms. Calculate Zin(CL) and Zout(CL)
# Given data
Avol = 100000.# # Open loop voltage gain=100,000
Ri = 2.0*10**6# # Input resistance=2 MOhms
B = 1.0# # Beta=1
Zool = 75.# # Output impedence (open-loop)=75 Ohms
Zicl = Ri*(1+Avol*B)#
print 'The Input impedence closed-loop = %0.2e Ohms'% Zicl
print 'i.e 200 GOhms'
A = Avol*B#
Zocl = Zool/(1+A)#
print 'The Closed loop Output Impedence = %0.3f Ohms'%Zocl
# Calculate the closed-loop voltage gain, Acl, and the dc voltage at the op-amp output terminal.
# Given data
V = 15.# # Voltage at +ve terminal of op-amp=15 Volts
Rf = 10.*10**3# # Feedback resistance=10 kOhms
Ri = 1.*10**3# # Input resistance=1 kOhms
R1 = 10.*10**3# # Resistance1=10 kOhms
R2 = 10.*10**3# # Rsistance2=10 kOhms
Acl = -(Rf/Ri)#
print 'The Closed-Loop Voltage Gain Acl =%0.2f'%Acl
Vo = V*(R2/(R1+R2))#
print 'The Output Voltage = %0.2f Volts'%Vo
# Calculate the output voltage, Vout.
# Given data
V1 = 1# # Input voltage1=1 Volts
V2 = -5# # Input voltage2=-5 Volts
V3 = 3# # Input voltage3=3 Volts
Vo = -(V1+V2+V3)#
print 'The Output Voltage %0.f Volts'%Vo
# Calculate the output voltage, Vout.
# Given data
V1 = 0.5# # Input voltage1=0.5 Volts
V2 = -2.0# # Input voltage2=-2 Volts
Rf = 10.*10**3# # Feedback resistance=10 kOhms
R1 = 1.*10**3# # Resistance1=1 kOhms
R2 = 2.5*10**3# # Rsistance2=2.5 kOhms
A = Rf/R1#
B = Rf/R2#
Vo = -(A*V1+B*V2)#
print 'The Output Voltage = %0.2f Volts'%Vo
# Calculate the output voltage, Vout, if (a) Vx is 1 Vdc and Vy is -0.25 Vdc, (b) -Vx is 0.5 Vdc and Vy is 0.5 Vdc, (c) Vx is 0.3 V and Vy is 0.3 V.
# Given data
Rf = 10.*10**3# # Feedback resistance=10 kOhms
R1 = 1.*10**3# # Resistance1=1 kOhms
Vx1 = 1.# # Input voltage Vx1 at -ve terminal of op-amp=1 Volts
Vy1 = -0.25# # Input voltage Vy1 at +ve terminal of op-amp=-0.25 Volts
Vx2 = -0.5# # Input voltage Vx2 at -ve terminal of op-amp=-0.5 Volts
Vy2 = 0.5# # Input voltage Vy2 at +ve terminal of op-amp=0.5 Volts
Vx3 = 0.3# # Input voltage Vx3 at -ve terminal of op-amp=0.3 Volts
Vy3 = 0.3# # Input voltage Vy3 at +ve terminal of op-amp=0.3 Volts
A = -Rf/R1#
# Case A
Voa = A*(Vx1-Vy1)#
print 'The Output Voltage of Case A = %0.2f Volts'%Voa
# Case B
Voa = A*(Vx2-Vy2)#
print 'The Output Voltage of Case B = %0.2f Volts'%Voa
# Case C
Voa = A*(Vx3-Vy3)#
print 'The Output Voltage of Case C = %0.2f Volts'%Voa
# Assume that Rd increases to 7.5 k due to an increase in the ambient temperature. Calculate the output of the differential amplifier. Note: Rb is 5 kOhms.
# Given data
Vi = 5.# # Voltage input=5 Volts(dc)
Rf = 10.*10**3# # Feedback resistance=10 kOhms
R1 = 1.*10**3# # Resistance1=1 kOhms
Ra = 5.*10**3# # Resistance A at wein bridge=5 kOhms
Rb = 10.*10**3# # Resistance B at wein bridge=10 kOhms
Rc = 5.*10**3# # Resistance C at wein bridge=5 kOhms
Rd = 7.5*10**3# # Resistance D at wein bridge=7.5 kOhms
Vx = Vi*(Ra/Rb)#
Vy = Vi*(Rd/(Rd+Rc))#
A = -Rf/R1
Vo = A*(Vx-Vy)#
print 'The Output of Differential Amplifier = %0.2f Volts'%Vo
from math import pi
# Calculate the cutoff frequency, fc.
# Given data
Rf = 10.*10**3# # Feedback resistance=10 kOhms
Cf = 0.01*10**-6# # Feedback capacitance=0.01 uFarad
fc = 1./(2.*pi*Rf*Cf)#
print 'The Cutoff Frequency = %0.2e Hertz'%fc
print 'i.e 1.591 kHz'
from math import pi,sqrt
# Calculate the Voltage gain, Acl at (a)0 Hz and (b) 1 MHz
# Given data
f1 = 1.*10**6# # Frequency=1 MHertz
Rf = 10.*10**3# # Feedback resistance=10 kOhms
R1 = 1.*10**3# # Resistance1=1 kOhms
Cf = 0.01*10**-6# # Feedback capacitance=0.01 uFarad
# At 0 Hz, Xcf = infinity ohms, So, Zf=Rf
Acl = -Rf/R1#
print 'The Closed-Loop Voltage Gain at 0 Hz =%0.2f'%Acl
# At 1 MHz
Xcf = 1/(2*pi*f1*Cf)#
A = (Rf*Rf)#
B = (Xcf*Xcf)#
Zf = ((Xcf*Rf)/sqrt(A+B))#
Acl1 = -Zf/R1#
print 'The Closed-Loop Voltage Gain at 1 MHz =%0.2f'%Acl1
from math import log10,pi,sqrt
# Calculate the dB voltage gain, at (a)0 Hz and (b) 1.591 kHz
# Given data
f1 = 1.591*10**3# # Frequency=1.591 kHertz
Rf = 10.*10**3# # Feedback resistance=10 kOhms
Ri = 1.*10**3# # Input resistance=1 kOhms
Cf = 0.01*10**-6# # Feedback capacitance=0.01 uFarad
# At 0 Hz, Xcf = infinity ohms, So, Zf=Rf
A = Rf/Ri
Acl = 20*log10(A)#
print 'The Voltage Gain at 0 Hz = %0.2f dB'%Acl
# At 1.591 kHz
Xcf = 1/(2*pi*f1*Cf)#
B = (Rf*Rf)#
C = (Xcf*Xcf)#
Zf = (Xcf*Rf/sqrt(B+C))#
D = Zf/Ri#
Acl1 = 20*log10(D)#
print 'The Voltage Gain at 1.591 kHz = %0.2f dB'%Acl1
print 'approx 17dB'
from math import pi
# Calculate the cutoff frequency, fc.
# Given data
Ri = 1.*10**3# # Input resistance=10 kOhms
Ci = 0.1*10**-6# # Input capacitance=0.01 uFarad
fc = 1/(2*pi*Ri*Ci)#
print 'The Cutoff Frequency = %0.2f Hertz'%fc
print 'i.e 1.591 kHz'
# Vin is 5 V, R is 1 kOhms , and Rl is 100 Ohms . Calculate the output current, Iout.
# Given data
Vin = 5.# # Input votage=5 Volts
Ri = 1.*10**3# # Input resistance=1 kOhms
Rl = 100.# # Load resistance=100 Ohms
Io = Vin/Ri#
print 'The Output Current = %0.2e Amps'%Io
print 'i.e 5 mAmps'
# Iin is 1.5 mA, R is 1 kOhms, and Rl is 10 kOhms. Calculate Vout.
# Given data
Iin = 1.5*10**-3# # Input votage=5 Volts
Ri = 1.*10**3# # Input resistance=1 kOhms
Rl = 100.# # Load resistance=100 Ohms
Vo = Iin*Ri#
print 'The Output Voltage = %0.2f Volts'%Vo
# R1 is 1 kOhms and R2 is 100 kOhms . Calculate UTP, LTP, and VH.
# Given data
R1 = 1.*10**3# # Resistance1=1 kOhms
R2 = 100.*10**3# # Resistance2=100 kOhms
Vcc = 15.# # Applied votage=15 Volts
Vsat = 13.# # Assume Saturation voltage=13 Volts
Beta = R1/(R1+R2)#
Utp = Beta*Vsat#
print 'The Upper Trigger Point = %0.3f Volts'%Utp
print 'i.e 128.7 mVolts'
Ltp = -Beta*Vsat#
print 'The Lower Trigger Point = %0.3f Volts'%Ltp
print 'i.e -128.7 mVolts'
Vh = Utp-Ltp#
print 'The Hysterisis Voltage = %0.3f Volts'%Vh
print 'i.e 257.4 mVolts'
# Rl is 1 kOhms and the frequency of the input voltage equals 100 Hz. Calculate the minimum value of C required.
# Given data
f = 100.# # Applied frequency=100 Hertz
Rl = 1.*10**3# # Load resistance=1 kOhms
T = 1./f#
C = (10*T)/Rl#
print 'The Minimum value of required Capacitor = %0.2e Farads'%C
print 'i.e 100 uFarad'