## Example 22-4, Page 854¶

In [12]:
import math

Vin=10                                #ac input(V)
Vs=15                                 #non-inverting input voltage(V)
R1=200.0*10**3                        #non-inverting input resistance R1(Ohm)
R2=100.0*10**3                        #non-inverting input resistance R2(Ohm)
C=10*10**-6                           #capacitance at non-inverting input(F)

Vref=Vs/3                                      #reference voltage at trip point(V)
fc=(2*math.pi*((R1**-1+R2**-1)**-1)*C)**-1      #cutoff frequency(Hz)

print 'trip point voltage Vref = ',Vref,'V'
print 'cutoff frequency of bypass circuit fc = ',round(fc,2),'Hz'

trip point voltage Vref =  5 V
cutoff frequency of bypass circuit fc =  0.24 Hz


## Example 22-5, Page 855¶

In [10]:
import math

Vp=10.0                                #sine peak(V)
Vin=5.0                                #input voltage(V)

theta=math.ceil((math.asin(Vin/Vp))*180/math.pi)  #angle theta (deg)
D=(150-theta)/360.0                              #duty cycle

print 'theta = ',theta,'degrees'
print 'duty cycle D = ',round((D*100),2),'%'

theta =  31.0 degrees
duty cycle D =  33.06 %


## Example 22-6, Page 860¶

In [4]:
R1=1.0                              #non-inverting input resistance R1(KOhm)
R2=47.0                             #feedback path resistance R2(KOhm)
Vsat=13.5                           #saturation voltage(V)

B=R1/(R1+R2)                       #feedback fraction
UTP=B*Vsat                         #upper trip point
LTP=-B*Vsat                        #lower trip point
H=UTP-LTP                          #hysteresis

print 'lower trip point LTP = ',round(LTP,2),'V'
print 'upper trip point LTP = ',round(UTP,2),'V'
print 'hysteresis is ',round(H,2),'V'

lower trip point LTP =  -0.28 V
upper trip point LTP =  0.28 V
hysteresis is  0.56 V


## Example 22-7, Page 865¶

In [19]:
R=2                                #inverting input resistance R1(KOhm)
C=1*10**-6                         #feedback path capacitance (F)
T=1*10**-3                         #time period(s)
Vin=8                              #input pulse voltage(V)
AVOL=100000                        #open loop voltage gain

V=Vin*T/(R*C)/1000                      #output voltage(V)
t=R*C*(AVOL+1)*1000                     #time constant(s)

print 'Magnitude of negative output voltage at end of the pulse = ',V,'V'
print 'closed loop time constant = ',t,'s'

Magnitude of negative output voltage at end of the pulse =  4.0 V
closed loop time constant =  200.002 s


## Example 22-8, Page 868¶

In [22]:
R1=1*10**3                         #inverting input resistance R1(Ohm)
R2=10*10**3                        #feedback path resistance R2(Ohm)
C=10*10**-6                        #feedback path capacitance (F)
Vin=5                              #input pulse voltage(V)
f=1*10**3                          #input frequency(Hz)

Vout=Vin/(2*f*R1*C)                 #output voltage(V)

print 'peak to peak output voltage = ',Vout,'Vpp'

peak to peak output voltage =  0.25 Vpp


## Example 22-9, Page 868¶

In [5]:
Vs=15.0                               #non-inverting input voltage(V)
Rw=5.0*10**3                          #inverting input wiper resistance(Ohm)
R1=10.0*10**3                         #inverting input resistance R1(Ohm)
f=1.0                                 #input frequency(KHz)

Vref=Vs*(Rw/(Rw+R1))                  #reference voltage(V)
T=1/f                                 #period of signal(s)
W=2*(T/2)*((Vs/2)-Vref)/Vs            #output pulse width
D=W/T                                 #duty cycle

print 'duty cycle D = ',round((D*100),2),'%'

duty cycle D =  16.67 %


## Example 22-10, Page 871¶

In [18]:
import math

R1=18.0                             #non-inverting input resistance R1(KOhm)
R2=2.0                              #feedback path resistance R2(KOhm)
R=1.0                               #feedback path resistance R(KOhm)
C=0.1*10**-6                        #feedback path capacitance (F)

B=R1/(R1+R2)                             #feedback fraction
T=10**9*2*R*C*math.log((1+B)/(1-B))      #period of output(us)
f=1000*1/T                               #frequency(KHz)

print 'period T = ',round(T,2),'us'
print 'frequency f = ',round(f,2),'KHz'

period T =  588.89 us
frequency f =  1.7 KHz


## Example 22-11, Page 871¶

In [9]:
Vsat=13.5                          #saturation voltage given(V)
R4=10*10**3                        #given resistance R4(Ohm)
C2=10*10**-6                       #given capacitance C2(F)
T=589*10**-6                       #period from preceding example(s)

Vout=Vsat*T/(2*R4*C2)              #output voltage (V)

print 'Output voltage = ',round((Vout*1000),2),'mVpp'

Output voltage =  39.76 mVpp


## Example 22-12, Page 873¶

In [37]:
R1=1*10**3                        #resistance R1(Ohm)
R2=100*10**3                      #resistance R2(Ohm)
R3=10*10**3                       #resistance R3(Ohm)
C=10*10**-6                       #capacitance (F)

UTP=Vsat*R1/R2                     #UTP value (V)
Vout=2*UTP                         #output voltage/hysteresis (V)
f=R2/(4*R1*R3*C)                   #frequency(Hz)

print 'Vout = H = ',Vout,'V'
print 'frequency f = ',f,'Hz'

Vout = H =  0.27 V
frequency f =  250.0 Hz