Chapter11 - Non linear applications of op-amp

Ex 11.1 - page : 354

In [4]:
from __future__ import division
from math import log
Vin=12.5 #V
Ri=10 #kohm
IS=10**-13 #A
T=27 #degree C
VT=26 #mV
Vref=Ri*IS*1000 #V
Vout=-VT*10**-3*log(Vin/Vref) #V
print "Output Voltage, Vout = %0.1f V " %Vout
Output Voltage, Vout = -0.6 V 

Ex 11.3 - page : 362

In [33]:
from __future__ import division
R1=10 #kohm
k=1.38*10**-23 #J/K
T=298 #K
q=1.6*10**-19 #C
Kdash=k*T/q #Kdash=k*T/q assumed for temporary calculation
print "Output Voltage, Vout(V) is ",round(-Kdash,4),"*log(Vin/%0.f*10**3)" %R1
#Not possible to tale log of symbols.
Output Voltage, Vout(V) is  -0.0257 *log(Vin/10*10**3)

Ex 11.4 - page : 362

In [32]:
from __future__ import division
R1=10 #kohm
R2=10 #kohm
k=1.38*10**-23 #J/K
T=298 #K
q=1.6*10**-19 #C
Kdash=k*T/q #Kdash=k*T/q assumed for temporary calculation
print "Output Voltahe, Vout(V) is -R1*(log(",round(-1/Kdash,1),"*Vin)**-1"
#Not possible to tale log of symbols.
Output Voltahe, Vout(V) is -R1*(log( -38.9 *Vin)**-1

Ex 11.7 - page : 366

In [44]:
from __future__ import division
from math import log10
k=1 #for the givn connection
#(a)
Vin=5 #V
Vout=-k*log10(Vin/0.1) #V
print "(a) For 5V input, Output Voltage = %0.2f V " %Vout
#(b)
Vin=2 #V
Vout=-k*log10(Vin/0.1) #V
print "(b) For 2V input, Output Voltage = %0.1f V " %Vout 
#(c)
Vin=0.1 #V
Vout=-k*log10(Vin/0.1) #V
print "(c) For 0.1V input, Output Voltage = %0.f V " %Vout 
#(d)
Vin=50 #mV
Vout=-k*log10(Vin/1000/0.1) #V
print "(d) For 50mV input, Output Voltage = %0.1f V " %Vout 
#(e)
Vin=5 #mV
Vout=-k*log10(Vin/1000/0.1) #V
print "(e) For 5mV input, Output Voltage = %0.1f V " %Vout 
(a) For 5V input, Output Voltage = -1.70 V 
(b) For 2V input, Output Voltage = -1.3 V 
(c) For 0.1V input, Output Voltage = -0 V 
(d) For 50mV input, Output Voltage = 0.3 V 
(e) For 5mV input, Output Voltage = 1.3 V 

Ex 11.8 - page : 367

In [49]:
from __future__ import division
from math import log10
k=1 #for the givn connection
#For 755N module
Rin=10 #kohm
Iref=10 #micro A
Vref=Rin*Iref/1000 #V
#(a)
Vin=5 #V
Vout1=-k*log10(Vin/0.1) #V
Vout=Vref*10**(-Vout1/k) #V
print "(a) For 5V input to log amp, Antilog amp Output = %0.f V " %Vout 
#(b)
Vin=2 #V
Vout1=-k*log10(Vin/0.1) #V
Vout=Vref*10**(-Vout1/k) #V
print "(b) For 2V input to log amp, Antilog amp Output = %0.f V " %Vout 
#(c)
Vin=0.1 #V
Vout1=-k*log10(Vin/0.1) #V
Vout=Vref*10**(-Vout1/k) #V
print "(c) For 0.1V input to log amp, Antilog amp Output = %0.1f V " %Vout 
#(d)
Vin=50 #mV
Vout1=-k*log10(Vin/1000/0.1) #V
Vout=Vref*10**(-Vout1/k) #V
print "(d) For 50mV input to log amp, Antilog amp Output = %0.f mV " %(Vout*1000)
#(e)
Vin=5 #mV
Vout1=-k*log10(Vin/1000/0.1) #V
Vout=Vref*10**(-Vout1/k) #V
print "(e) For 5mV input to log amp, Antilog amp Output = %0.f mV " %(Vout*1000)
(a) For 5V input to log amp, Antilog amp Output = 5 V 
(b) For 2V input to log amp, Antilog amp Output = 2 V 
(c) For 0.1V input to log amp, Antilog amp Output = 0.1 V 
(d) For 50mV input to log amp, Antilog amp Output = 50 mV 
(e) For 5mV input to log amp, Antilog amp Output = 5 mV