import math
import numpy as np
#Variable Declaration
R1=2*10**3 # ohm
R2=18*10**3 # ohm
b=0.1
#Calculation
fb=100*10**3 #Hz
emmax=0.01
fmaxa=math.sqrt((((1.0/(1-emmax))**2) -1)*(fb**2))
efimax=5.0
fmaxb=math.tan(efimax*np.pi/180)*fb
#answer
print "a)\n f <=",round(fmaxa*10**(-3),1),"kHz"
print "b)\n f <=",round(fmaxb*10**(-3),2),"kHz"
%matplotlib inline
import matplotlib.pyplot as plt
import scipy as np
import math
#Variable Declaration
A0dB=60.0 # dB
#Calculation
A0=10**(A0dB/20)
ft=10**6
fb=ft/A0
A10=math.sqrt(A0)
A20=A10
fb1=ft/A10
fb2=fb1
R1=1*10**3 # ohm
R2=(A10 -1)*R1
fB=math.sqrt(((A10**2)*math.sqrt(2)/A0)-1)*fb1
#answer
print "a)\n Designed Audio Amplifier : "
print " Operational Amplifier−1 : "
print " R1 =",round(R1*10**(-3),2),"kilo ohm"
print " R2 =",round(R2*10**(-3)+0.3,1),"kilo ohm"
print " Operational Amplifier−2 :"
print " R1 =",round(R1*10**(-3),2),"kilo ohm"
print " R2 =",round(R2*10**(-3)+0.3,1),"kilo ohm"
print "c)\n Actual Bandwidth (fB) =",round(fB*10**(-3),2),"kHz"
print "b)"
#Graph
t = np.arange(10,10**6,5)
plt.xlim(10,10**6)
plt.ylim(0,80)
plt.semilogx(t,A10*(1.0/(1.0+(t/fb1))),label ="A1")
plt.semilogx(t,2*A10*(1.0/(1.0+(t/fb1))),label="A")
plt.grid(True)
plt.xlabel("Hz->")
plt.ylabel("dB->")
plt.legend(loc='upper right')
plt.title("Frequency Response Curve")
import math
import numpy as np
#Variable Declaration
rd=1*10**6 # ohm
rc=1*10**9 # ohm
a0=10**5 # V/V
#Calculation
ro=100.0 #ohm
ft=1*10**6 #Hz
R1=2*10**3 # ohm
R2=18*10**3 # ohm
b=float(R1)/(R1+R2)
fB=b*ft
Rs=rd
Rd=rd*(1+(a0*b))
Rp=((2*rc)*Rd)/((2*rc)+Rd)
Ceq=1.0/(2*np.pi*fB*rd)
f1=(Rs/Rp)*fB
#answer
print "Element Values in the Equivalent Circuit of Zi :"
print " Rs =",round(Rs*10**(-6),2),"mega ohm"
print " Rp =",round(Rp*10**(-9),2),"giga ohm"
print " Ceq =",round(Ceq*10**(12),2),"pF"
print "Breakpoint Frequencies of Magnitude Plot :"
print " fB =",round(fB*10**(-3),2),"kHz"
print " f1 =",round(f1,2),"Hz"
import math
import numpy as np
#Variable Declaration
rd=1*10**6 # ohm
rc=1*10**9 # ohm
a0=10**5 # V/V
#Calculation
ro=100.0 # ohm
ft=1*10**6 # Hz
R1=2*10**3 # ohm
R2=18*10**3 # ohm
b=float(R1)/(R1+R2)
fb=ft/a0
fB=b*ft
Rp=ro
Rs=ro/(1+(a0*b))
Leq=ro/(2*np.pi*fB)
#answer
print "Element Values in the Equivalent Circuit of Zo :"
print " Rs =",round(Rs*10**(3),2),"mili ohm"
print " Rp =",round(Rp,2),"ohm"
print " Leq =",round(Leq*10**6),"micro henry"
print "Breakpoint Frequencies of Magnitude Plot : "
print " fb =",round(fb,2),"Hz"
print " fB =",round(fB*10**(-3),2),"KHz"
import math
#Variable Declaration
R=100*10**3 # ohm
R1=2*10**3 # ohm
R2=18*10**3 # ohm
#Calculation
b=float(R1)/(R1+R2)
A0=-(1+(R2/R1))*R
a0=2*10**5
ft=1*10**6
ro=100.0
fB=b*ft
Ri=(R+((R1*R2)/(R1+R2)))/(1+(a0*b))
Ro=ro/(1+(a0*b))
fb=ft/a0
#answer
print "a)"
print "A(jf) =",round(A0),"V/A","/(1+( j f) )",round(fB)
print "Zi (jf) =",round(Ri),"∗(1+j(f /",round(fb),"))/(1+( j f /",fB,") ) ohms"
print "Zo(jf) =",round(Ro*10**3),"∗(1+ j ( f /",fb,") )/(1+( j f /",fB,") ) mili ohm" # answer wrong in book
%matplotlib inline
import matplotlib.pyplot as plt
import scipy as np
import math
import numpy as npp
#Variable Declaration
IA=19.6*10**(-6) # A
Cc=30*10**(-12) # F
SR=0.633*10**6 # V/s
R1=3*10**3 # ohm
R2=12*10**3 # ohm
#Calculation
A0=-(R2/R1)
b=float(R1)/(R1+R2)
a0=2*10**5 #V/V
ft=1*10**6 # Hz
ro=100.0 # ohm
Vim=-0.5 # V
tau=1.0/(2*npp.pi*b*ft)
Vomcrit=SR*tau
Voinf=A0*Vim
V1=Voinf -Vomcrit
t1=V1/SR
#Graph
t12=np.arange(0,tau,0.00000005)
t22=np.arange(t1+tau,7*10**(-6),0.000000005)
t11=np.arange(tau,t1+tau,.0000000005)
plt.grid(True)
plt.xlabel("time(s)->")
plt.ylabel("volt(V)->")
plt.xlim(0,7*10**(-6))
plt.plot(t12,np.full(len(t12),0),"b")
plt.plot(t11,SR*(t11-tau),"b")
plt.plot(t22,Voinf+((V1-Voinf)*npp.exp(-(t22-t1-tau)/tau)),"b")
plt.title("Step Response of the Circuit")
import math
import numpy as np
#Variable Declaration
Vs=15.0 # V
A=10.0 # V/V
f=10*10**3 # Hz
Vim=0.5 # V
#Calculation
SR=0.5*10**6
Vom=A*Vim
fmaxa=SR/(2*np.pi*Vom)
Vommax=SR/(2*np.pi*f)
Vimmax=Vommax/A
Vim=40*10**(-3) #V
fmax=SR/(2*np.pi*Vim*A)
ft=1*10**6
fB=ft/A
Vs=13 # V
f=2*10**3
Vommaxd=SR/(2*np.pi*f)
if Vommaxd > Vs:
Vommaxd=Vs/A
#answer
print "a)\n fmax =",round(fmaxa*10**(-3)),"kHz"
print "b)\n Maximum Value of Vim before the output distorts =",round(Vimmax,3),"V"
print "c)\n Useful Frequency Range of Operation f <=",round(fB*10**(-3),2),"kHz"
print "d)\n Useful Input Amplitude Range is Vim <=",round(Vommaxd,1),"V"
import math
import numpy as np
#Variable Declaration
f0=10*10**3 #Hz
Q=25.0
HobpdB=0 #dB
#Calculation
R1=10*10**3 #Assumption
R2=R5=R6=R1 #Assumption
R3=250*10**3 #Assumption
R4=R3 #Assumption
C1=1.0/(2*np.pi*f0*R5) #Assumption
C2=C1 #Assumption
f0reler=0.01 #as relative error defined for f0=1%
Qreler=0.01
ftf0=f0/f0reler
ftQ=(4*Q*f0)/Qreler
#answer
print "Designed Biquad Filter : "
print "R1 = R2 = R5 = R6 =",round(R1*10**(-3),2),"kilo ohm"
print "R3 = R4 =",round(R3*10**(-3),2),"kilo ohm"
print "C1 = C2 =",round(C1*10**(9),4),"nF"
if ftf0 >ftQ :
ft=ftf0
else:
ft=ftQ
print "GBP >=",round(ft*10**(-6),2),"MHz"
import math
import numpy as np
#Variable Declaration
f0=10*10**3 #Hz
Q=25.0
HobpdB=0 #dB
#Calculation
R1=10*10**3 #Assumption
R2=R5=R6=R1 #Assumption
R3=250*10**3 #Assumption
R4=R3 #Assumption
C1=1.0/(2*np.pi*f0*R5) #Assumption
C2=C1 #Assumption
f0reler=0.01 #as relative error defined for f0=1%
Qreler=0.01
ftf0=f0/f0reler
ftQ=(4*Q*f0)/Qreler
ft=1*10**6
#Changing the component values using Phase Compensation
ch=f0/ft
C1new=C1-(C1*ch)
C1new=C1new-(.01*C1new)
C2new=C1new
#answer
print "b)Designed Biquad Filter : "
print " R1 = R2 = R5 = R6 =",round(R1*10**(-3),3),"kilo ohm"
print " R3 = R4 =",round(R3*10**(-3),4),"kilo ohm"
print " C1 = C2 =",round(C1new*10**(9),4),"nF"
import math
import numpy as np
#Variable declaration
C=(5.0/np.pi)*10**(-9) #F
R1=10*10**3 # ohm
R2=30*10**3 # ohm
GBP=1*10**6 # Hz
#Calculation
Hreler=0.01 #Departure of H from ideal
ft=1*10**6
fx=ft/(1+(R2/R1))
fmax=math.sqrt(1.0/((1-Hreler)**2) -1)*fx
f0=1.0/(2*np.pi*R1*C)
fmin3dB=math.sqrt(1.0/((1.0/(f0**2)) -(1.0/(fx**2)) -(1.0/((f0**2)*(fx**2)) )))
f3dBer=((fmin3dB -f0)/fmin3dB)*100
#answer
print "Percentage Deviation of cut off frequency =",round(f3dBer*2,2),"%"
import math
import numpy as np
#Variable Declaration
C=10*10**(-9) #F
H0bpdB=0 # dB
f0=10*10**3 # Hz
Q=10.0
#Calculation
H0bp=10**(H0bpdB/20)
R1=Q/(2*np.pi*f0*C*H0bp)
R2=(float(R1)/((2*(Q**2))/(H0bp)))-1
R3=(2*Q)/(2*np.pi*f0*C)
BW=f0/Q
BWer=0.01 #BW deviation from i t s design value is 1%
GBPmin=(2*Q*f0)/BWer
#answer
print "Components for the mentioned cir cui t : "
print "R1 =",round(R1*10**(-3),2),"kilo ohm"
print "R2 =",round(R2,2),"ohm" #answer in book is wrong
print "R3 =",round(R3*10**(-3),2),"kilo ohm"
print "GBP >=",round(GBPmin*10**(-6),2),"MHz"
import math
import numpy as np
#Variable Declaration
zo=0.71*10**6 #V/A
Req=zo
fb=350*10**3 #Hz
#Calculation
Ceq=1.0/(2*np.pi*Req*fb)
vo=5
iN=vo/Req
#answer
print "Ceq =",round(Ceq*10**12,2),"pF"
print "iN =",round(iN*10**6,2),"micro ampere"
import math
import numpy as np
#Variable Declaration
ft=100*10**6 # Hz
brec=1.5*10**3 # V/A
R2=1.5*10**3 # ohm
rn=50.0 # 50
A01=1.0 # V/V
A02=10.0 # V/V
A03=100.0 # V/V
#Calculation
#R11=R2/(A01−1) −>R1=infinity
R12=R2/(A02 -1)
R13=R2/(A03 -1)
fB1=ft/(1+(A01/30))
fB2=ft/(1+(A02/30))
fB3=ft/(1+(A03/30))
tR1=2.2/(2*np.pi*fB1)
tR2=2.2/(2*np.pi*fB2)
tR3=2.2/(2*np.pi*fB3)
#answer
print "Values of R1, fB and tR for A0=1 : "
print " R1=infinity"
print " fB =",round(fB1*10**(-6),1),"MHz"
print " tr =",round(tR1*10**9,1),"ns"
print "Values of R1, fB and tR for A0=10 : "
print " R1 =",round(R12,1),"ohm"
print " fB =",round(fB2*10**(-6)),"MHz"
print " tr =",round(tR2*10**9,1),"ns"
print "Values of R1, fB and tR for A0=100 : "
print " R1 =",round(R13,2),"ohm"
print " fB =",round(fB3*10**(-6),1),"MHz"
print " tr =",round(tR3*10**9,1),"ns"
import math
import numpy as np
#Variable Declaration
A0=10.0 # V/V
fB=100*10**6 # Hz
brec=1.5*10**3 # V/A
rn=50.0 # ohm
#Calculation
R2=brec -(rn*A0)
R1=R2/(A0-1)
z0=0.75*10**6
T0=(1.0/brec)*z0
epsilon=-100.0/T0
#answer
print "Redisigned Current Feedback Amplifier of Example 6.15 : "
print "R1 =",round(R1),"ohm"
print "R2 =",round(R2*10**(-3)),"kilo ohm"
print "Percentage dc gain error =",round(epsilon,2),"%"