# Given data
G= -100
R1= 2.2 # in kohm
R1=R1*10**3 # in ohm
# Formula G=-Rf/R1
Rf= -G*R1
print "The value of Rf = %0.f kohm " %(Rf*10**-3)
# Given data
Rf= 200 # in kohm
R1= 2 # in kohm
vin=2.5 # in mV
vin=vin*10**-3 # in volt
G= -Rf/R1
vo= G*vin # in V
print "The output voltage = %0.2f Volt " %vo
# Given data
G=-10
Ri= 100 # in kohm
R1= Ri # in kohm
R1=R1*10**3 # in ohm
# Formula G=-R2/R1
R2= R1*abs(G) # ohm
print "Value of R1 = %0.f kohm " %(R1*10**-3)
print "and value of R2 = %0.f Mohm " %(R2*10**-6)
# Given data
R1= 100 # in kohm
R2= 500 # in kohm
V1= 2 # in volt
Vo= (1+R2/R1)*V1 # in volt
print "Output voltage for noninverting amplifier = %0.f Volt" %Vo
from __future__ import division
# Given data
Rf= 1 # in Mohm
Rf=Rf*10**6 #in ohm
# Part(a)
V1=1 #in volt
V2=2 #in volt
V3=3 #in volt
R1= 500 # in kohm
R1=R1*10**3 #in ohm
R2= 1 # in Mohm
R2=R2*10**6 #in ohm
R3= 1 # in Mohm
R3=R3*10**6 #in ohm
Vo= -Rf*(V1/R1+V2/R2+V3/R3) # in volt
print "(a) Output voltage = %0.f Volt " %Vo
# Part(b)
V1=-2 #in volt
V2=3 #in volt
V3=1 #in volt
R1= 200 # in kohm
R1=R1*10**3 #in ohm
R2= 500 # in kohm
R2=R2*10**3 #in ohm
R3= 1 # in Mohm
R3=R3*10**6 #in ohm
Vo= -Rf*(V1/R1+V2/R2+V3/R3) # in volt
print "(b) Output voltage = %0.f Volt" %Vo
from __future__ import division
# Given data
print "Minimum closed loop voltage gain for R2=0 and R1= 2 kohm"
R2=0
R1=2 # in kohm
R1=R1*10**3 # in ohm
Av_min= (1+R2/R1)
print "Av(min) =",Av_min
print "Maximum closed loop voltage gain for maximum value of R2=100 kohm and R1= 2 kohm"
R2=100 # in kohm
R1=2 # in kohm
Av_max= (1+R2/R1)
print "Av(max) =",Av_max
from __future__ import division
# Given data
V1= 745 # in µV
V2= 740 # in µV
V1=V1*10**-6 # in volt
V2=V2*10**-6 # in volt
CMRR=80 # in dB
Av=5*10**5
# (i)
# CMRR in dB= 20*log(Ad/Ac)
Ad=Av
Ac= Ad/10**(CMRR/20)
# (ii)
Vo= Ad*(V1-V2)+Ac*(V1+V2)/2
print "Output voltage = %0.2f Volt" %Vo
# Note:- In the book, there is calculation error to evaluate the value of Ac,
#so the value of Ac is wrong ans to evaluate the output voltage there is also calculation error
from __future__ import division
# Given data
R1= 1 # in Mohm
Ri=R1 # in Mohm
Rf=1 # in Mohm
A_VF= -Rf/R1
print "Voltage gain = %0.f" %A_VF
from __future__ import division
# Given data
V1=2 # in V
V2=3 # in V
Rf=3 # in kohm
R1=1 # in kohm
Vo1= (1+Rf/R1)*V1
print "Output voltage when only 2V voltage source is acting is %0.f Volt" %Vo1
Vo2= (1+Rf/R1)*V2
print "Output voltage due to 3V voltage source is %0.f Volt" %Vo2
Vo= Vo1+Vo2 # in volts
print "Total output voltage is %0.f Volts" %Vo
from __future__ import division
# Given data
Rf=500 # in kohm
min_vvs= 0 # minimum value of variable resistor in ohm
max_vvs= 10 # maximum value of variable resistor in ohm
Ri_min= 10+min_vvs # in kohm
Ri_max= 10+max_vvs #in kohm
# Av= Vo/Vi= -Rf/Ri
Av=-Rf/Ri_min
print "Closed loop voltage gain corresponding to Ri(min) is",Av
Av=-Rf/Ri_max
print "and closed loop voltage gain corresponding to Ri(max) is",Av
# Given data
Rf=200 # in kohm
R1= 20 # in kohm
# Av= Vo/Vi= -Rf/Ri
Av= -Rf/R1
Vi_min= 0.1 # in V
Vi_max= 0.5 # in V
# Vo= Av*Vi
Vo_min= Av*Vi_min # in V
Vo_max= Av*Vi_max # in V
print "Output voltage ranges from",Vo_min,"V to",Vo_max,"V"
from __future__ import division
# Given data
Rf= 250 # in kohm
# Output voltage expression, Vo= -5*Va+3*Vb
# and we know that for a difference amplifier circuit,
# Vo= -Rf/R1*Va + [R2/(R1+R2)]*[1+Rf/R1]*Vb
# Comparing both the expression, we get
# -Rf/R1*Va= -5*Va, or
R1= Rf/5 # in kohm
print "The value of R1 = %0.2f kohm" %R1
# and
R2= 3*R1**2/(R1+Rf-3*R1)
print "The value of R2 = %0.2f kohm" %R2
# Note : Answer in the book is wrong
# Given data
Vi_1= 150 # in µV
Vi_2= 140 # in µV
Vd= Vi_1-Vi_2 # in µV
Vd=Vd*10**-6 # in V
Vc= (Vi_1+Vi_2)/2 # in µV
Vc=Vc*10**-6 # in V
# Vo= Ad*Vd*(1+Vc/(CMRR*Vd))
# (i) For Ad=4000 and CMRR= 100
Ad=4000
CMRR= 100
Vo= Ad*Vd*(1+Vc/(CMRR*Vd)) # in volt
print "(a) Output voltage = %.1f mV" %(Vo*10**3)
# (ii) For Ad=4000 and CMRR= 10**5
Ad=4000
CMRR= 10**5
Vo= Ad*Vd*(1+Vc/(CMRR*Vd)) # in volt
print "(b) Output voltage = %0.1f mV" %(Vo*10**3)
from __future__ import division
# Given data
Rf=470 # in kohm
R1=4.3 # in kohm
R2=33 # in kohm
R3=33 # in kohm
Vi= 80 # in µV
Vi=Vi*10**-6 # in volt
A1= 1+Rf/R1
A2=-Rf/R2
A3= -Rf/R3
A=A1*A2*A3
Vo= A*Vi # in volt
print "Output voltage = %0.2f Volts" %Vo
from sympy import symbols, simplify, sin
t = symbols('t')
# Given data
R1= 33 # in kΩ
R2= 10 # in kΩ
R3= 330 # in kΩ
V1 = simplify(50*sin(1000*t)) # in mV
V2 = simplify(10*sin(3000*t)) # in mV
Vo = -(R3/R1*V1+R3/R2*V2)/1000 # in V
print "Output voltage is",Vo
from __future__ import division
# Given data
R1=10 # in kohm
R2=150 # in kohm
R3=10 # in kohm
R4=300 # in kohm
V1= 1 # in V
V2= 2 # in V
Vo= ((1+R4/R2)*(R3*V1/(R1+R3))-(R4/R2)*V2)
print "Output voltage = %0.2f Volts" %Vo
from __future__ import division
# Given data
R1=12 # in kohm
Rf=360 # in kohm
V1= -0.3 # in V
Vo= (1+Rf/R1)*V1 # in V
print "(a) Output voltage result in %0.2f Volts" %Vo
# Part(b)
Vo= 2.4 # in V
# We know, Vo= (1+Rf/R1)*V1
V1= Vo/(1+Rf/R1)
print "(b) To result in an output of 2.4 Volt, Input voltage = %0.2f mV" %(V1*10**3)
from __future__ import division
# Given data
Rf=68 # in kohm
R1=33 # in kohm
R2=22 # in kohm
R3=12 # in kohm
V1= 0.2 # in V
V2=-0.5 # in V
V3= 0.8 # in V
Vo= -Rf/R1*V1 + (-Rf/R2)*V2 + (-Rf/R3)*V3 # in volts
print "Output voltage = %0.3f Volts" %Vo
#Answer in the textbook is not accurate.
from __future__ import division
# Given data
Rf=100 # in kohm
R1=20 # in kohm
V1= 1.5 # in V
Vo1= V1
Vo= -Rf/R1*Vo1 # in volts
print "Output voltage = %0.2f Volts" %Vo
from __future__ import division
# Given data
vo= -10 # in V
i_f= 1 # in mA
i_f= i_f*10**-3 #in A
# Formula vo= -i_f*Rf
Rf= -vo/i_f # in Ω
# The output voltage, vo= -(v1+5*v2) (i)
# vo= -Rf/R1*v1 - Rf/R2*v2 (ii)
# Comparing equations (i) and (2)
R1= Rf/1 # in Ω
R2= Rf/5 # in Ω
print "The value of Rf = %0.2f kΩ" %(Rf*10**-3)
print "The value of R1 = %0.2f kΩ" %(R1*10**-3)
print "The value of R2 = %0.2f kΩ" %(R2*10**-3)
from __future__ import division
from sympy import symbols
v1,v2 = symbols('v1 v2')
# Given data
R1= 9 # in kΩ
R2= 1 # in kΩ
R3= 2 # in kΩ
R4= 3 # in kΩ
# for node 1
va = R4/(R4+R3)*v1
vo1 = (1+R1/R2)*va
# for node 2
va=R3/(R3+R4)*v2
vo2 = (1+R1/R2)*va
vo = vo1+vo2
print "Total voltage is, vo =",vo
from __future__ import division
from sympy import symbols
v1,v2,v3 = symbols('v1 v2 v3')
# Given data
R1= 9 # in kΩ
R2= 1 # in kΩ
R3= 2 # in kΩ
R4= 3 # in kΩ
# Voltage at node 1
va= R4*v1/(R3+R4)
vo1= (1+R1/R2)*va
# Voltage at node 2
va= R3*v2/(R3+R4)
# From (i) and (ii)
vo2= (1+R1/R2)*va
# Voltage at node 3
va= R3*v2/(R3+R4)
vo3= (-R1/R2)*v3
vo = vo1+vo2+vo3
print "Total voltage is",vo
# Given data
import numpy as np
from __future__ import division
# omega_t= Ao*omega_b
# 2*pi*f_t = Ao*2*pi*f_b
# f_t= Ao*f_b
# Part (i)
Ao1= 10**5
f_b1= 10**2 # in Hz
f_t1= Ao1*f_b1 # in Hz
row1 = np.array([Ao1,f_b1,f_t1])
# Part (ii)
Ao2= 10**6
f_t2= 10**6 # in Hz
f_b2= f_t2/Ao2 # in Hz
row2 = np.array([Ao2,f_b2,f_t2])
# Part (iii)
f_b3= 10**3 # in Hz
f_t3= 10**8 # in Hz
Ao3= f_t3/f_b3
row3 = np.array([Ao3,f_b3,f_t3])
# Part (iv)
f_b4= 10**-1 # in Hz
f_t4= 10**6 # in Hz
Ao4= f_t4/f_b4
row4 = np.array([Ao4,f_b4,f_t4])
# Part (v)
Ao5= 2*10**5
f_b5= 10 # in Hz
f_t5= Ao5*f_b5 # in Hz
row5 = np.array([Ao5,f_b5,f_t5])
print "-"*33
print "Ao fb(Hz) ft(Hz)"
print "-"*33
print "%.e %.e %.e" %(row1[0], row1[1], row1[2])
print "%.e %.f %.e" %(row2[0], row5[1], row2[2])
print "%.e %.e %.e" %(row3[0], row3[1], row3[2])
print "%.e %.e %.e" %(row4[0], row4[1], row4[2])
print "%.e %.f %.e" %(row5[0], row5[1], row5[2])
# Answer for f_b2 is wrong in the textbook.
from __future__ import division
from numpy import sqrt
# Given data
Ao= 86 # in dB
A= 40 # in dB
f=100 # in kHz
f=f*10**3 # in Hz
# From 20*log(S) = 20*log(Ao/A), where S, stands for sqrt(1+(f/fb)**2)
S= 10**((Ao-A)/20)
# S= sqrt(1+(f/fb)**2)
fb= f/sqrt(S**2-1) # in Hz
Ao= 10**(Ao/20)
ft= Ao*fb # in Hz
print "The value of Ao = %0.3e" %Ao
print "The value of fb = %0.f Hz" %fb
print "The value of ft = %0.f MHz" %round(ft*10**-6)
from __future__ import division
from numpy import pi, sqrt
# Given data
Ao= 10**4 # in V/V
f_t= 10**6 # in Hz
R2byR1= 20
omega_t= 2*pi*f_t
omega_3dB= omega_t/(1+R2byR1)
f3dB= omega_3dB/(2*pi) # in Hz
print "3-dB frequency of the closed loop amplifier is %0.1f kHz" %(f3dB*10**-3)
f3dB= 0.1*f3dB # in Hz
voBYvi= -R2byR1/sqrt(1+(2*pi*f3dB/omega_3dB)**2)
voBYvi= abs(voBYvi) # in v/v
print "Gain = %0.1f v/v" %(voBYvi)