Chapter 2:First Experiences with Op Amp

Example 2.1 Page No 19

In [15]:
#Given
Vplus=15
Vminus=-15
Vsatp=13
Vsatm=-13          #All in Volts
Aol=200000.0         #gain
#Example 2-1(a)
Vam=-10*(10**-6)   #voltage at minus input
Vap=-15*(10**-6)   #voltage at plus input
Ed1=Vap-Vam        #Differential Input Voltage
Vout1=Ed1*Aol      #Output Voltage
if Vout1>15:
    print"Value of o/p voltage1 = 13.0000V"   #positive saturation voltage
elif(Vout1<-15):
    print"Value of o/p voltage1 = -13.0000V"  #negative saturation voltage
else:
    print" Value of o/p voltage1 =  ",Vout1*Vsatp,"V"

#Example 2-1(b)
Vbm=-10*(10**-6)    #voltage at minus input
Vbp=+15*(10**-6)    #voltage at plus input
Ed2=Vbp-Vbm         #Differential Input Voltage
Vout2=Ed2*Aol       #Output Voltage
if Vout2>15:
    print"Value of o/p voltage2 = 13.0000V"   #positive saturation voltage
elif(Vout2<-15):
    print"Value of o/p voltage2 = -13.0000V"  #negative saturation voltage
else:
    print" Value of o/p voltage2 =   ",Vout2,"V"

#Example 2-1(c)
Vcm=-10*(10**-6)         #voltage at minus input
Vcp=-5*(10**-6)          #voltage at plus input
Ed3=Vcp-Vcm              #Differential Input Voltage
Vout3=Ed3*Aol            #Output Voltage
if(Vout3>15):
    print"Value of o/p voltage3 = 13.0000V"  #positive saturation voltage
elif(Vout3<-15):
    print"Value of o/p voltage3 = -13.0000V"  #negative saturation voltage
else:
    print" Value of o/p voltage3 =  ",Vout3,"V"


#Example 2-1(d)
Vdm=+1.000001           #voltage at minus input
Vdp=+1.000000           #voltage at plus input
Ed4=Vdp-Vdm             #Differential Input Voltage
Vout4=Ed4*Aol           #Output Voltage
if(Vout4>15):
    print"Value of o/p voltage4 = 13.0000V"    #positive saturation voltage
elif(Vout4<-15):
    print"Value of o/p voltage4 = -13.0000V"    #negative saturation voltage
else:
    print" Value of o/p voltage4 =  ",round(Vout4,2),"V"


#Example 2-1(e)
Vem=+5*(10**-3)          #voltage at minus input
Vep=0                    #voltage at plus input
Ed5=Vep-Vem              #Differential Input Voltage
Vout5=Ed5*Aol            #Output Voltage
if(Vout5>15):
    print"Value of o/p voltage5 = 13.0000V"   #positive saturation voltage
elif(Vout5<-15):
    print"Value of o/p voltage5 = -13.0000V"   #negative saturation voltage
else:
    print" Value of o/p voltage5 =   ",Vout5

#Example 2-1(f)
Vfm=0                      #voltage at minus input
Vfp=+5*(10**-3)            #voltage at plus input
Ed6=Vfp-Vfm                #Differential Input Voltage
Vout6=Ed6*Aol              #Output Voltage
if(Vout6>15):
    print"Value of o/p voltage6 = 13.0000V"      #positive saturation voltage
elif(Vout6<-15):
    print"Value of o/p voltage6 = -13.0000V"    #negative saturation voltage
else:
    print" Value of o/p voltage6 =  V ",Vout6
 Value of o/p voltage1 =   -13.0 V
 Value of o/p voltage2 =    5.0 V
 Value of o/p voltage3 =   1.0 V
 Value of o/p voltage4 =   -0.2 V
Value of o/p voltage5 = -13.0000V
Value of o/p voltage6 = 13.0000V

Example 2.2 Page No 35

In [2]:
#Given
f=50.0           #in Hz
Vtemp=4.0        #input signal in volts
Ecm=10.0              

#Calculation
#Example 2-2(a)
T=1/f
Th=(Vtemp*T)/Ecm   #High time in seconds

#Example 2-2(b)
d=(Th/T)*100      #duty cycle in percentage

#Result
print" High Time is ",Th*1000,"ms"
print" Duty cycle is",d,"percent"
 High Time is  8.0 ms
 Duty cycle is 40.0 percent

Example 2.3 Page No 37

In [3]:
#Given
Vtemp=4.0               #in volts
Ecm=5.0                 #maximum peak voltage of a sawtooth carrier wave
T=0.01                #in seconds

#calculation
Th=T*(1-(Vtemp/Ecm))  #High Time

#Result
print" High Time is ",Th*1000,"ms"
 High Time is  2.0 ms