# Chapter 7: Waveform Generators

### Example No.7.1 , Page NO: 324

In [1]:
#Variable Declarartion:
import math
f=300.0                        #frequency in hertz

#Calculations:
t=f*C
R=1/(2*math.pi*t*math.sqrt(6))  #Calculating resistance value
R=R/1000                        #Calculating resistance value
R1=22000.0                      #Calculating resistance value
Rf=29.0*R1                      #Calculating resistance value
Rf=Rf/1000.0                    #Calculating resistance value

#Results:
print('R= %.2f kohm'%R)
print('\nLet R=2.2 kohm, hence R1=22 kohm')
print('\nRf= %d kohm'%Rf)

R= 2.17 kohm

Let R=2.2 kohm, hence R1=22 kohm

Rf= 638 kohm

### Example No. 7.2, Page No: 326

In [4]:
#Variable Declaration:
import math
f=2000.0                     #Frequency in hertz

#Calculations:
t=f*C
R=1/(2*math.pi*t)            #Calculating resistance value
R=R/1000.0                   #Calculating resistance value
R1=1800.0                    #Calculating resistance value
Rf=2.0*R1                    #Calculating resistance value
Rf=Rf/1000.0                 #Calculating resistance value

#Results:
print('R= %.3f kohm'%R)
print('\nLet R=1.8 kohm')
print('\nRf= %3f kohm'%Rf)
print('\nStandard value Rf= 3.3 kohm')

R= 1.592 kohm

Let R=1.8 kohm

Rf= 3.600000 kohm

Standard value Rf= 3.3 kohm

### Example No.7.3, Page No: 329

In [3]:
#Variable Declaration:
R1=116.0*10**3          #Resistance in ohm
R2=100.0*10**3          #Resistance in ohm
Vsat=14.0               #Voltage in volt

#Calculations:
# Part A
f=1000.0                #Frequency in hertz

T=1/f
# As log value is approx 1
RC=T/2                  #Calculating time constant
RC1=RC*1000.0           #Calculating time constant

# Part B
R=RC/C                  #Calculating resistance
Rn=R/1000.0             #Calculating resistance

# Part C
Vmax=2*Vsat*(R2/(R1+R2))     #Calculating maximum value of differential voltage

#Results:
print('RC= %.1f *10^-3 sec'%RC1)
print('\nR= %d kohm'%Rn)
print('\nMaximum value of differential input voltage= %.2f V'%Vmax)

RC= 0.5 *10^-3 sec

R= 50 kohm

Maximum value of differential input voltage= 12.96 V

### Exa ple NO. 7.4,Page NO: 330

In [4]:
#Variable Declaration:
fo=1000.0                 #Frequency in hertz
Vcc=12.0                  #Voltage Vcc in volt
R1=10.0*10**3             #Resistance in ohm
R2=10.0*10**3             #Resistance in ohm

#Calculations:
R=1/(2.2*C*fo)            #Calulating resistance value
R=R/1000.0                #Calculating resistance value

#Results:
print('R= %.3f kohm'%R)

R= 4.545 kohm

### Example No. 7.5, Page No: 334

In [2]:
#Variable Declaration:
R1=100.0*10**3           #Resistance in ohm
R3=20.0*10**3            #Resistance in ohm
Vsat=14.0                #Voltage in volt

#Calculations:
# Part A
T=4*R1*R2*C1/R3          #Calculating time period
Tn=T*1000                #Calculating time period

# Part B
f=1/T                    #Calculating frequency

# Part C

# Part D
Vp=R2*Vsat/R3           #Calculating peak value of the triangular wave

#Results:
print('Time period T= %d ms'%Tn)
print('\nfrequency f= %d Hz'%f)
print('\nPeak value is +14V and -14V')
print('\nTriangular wave oscillates between  %d V and - %d V'%(Vp,Vp))

Time period T= 2 ms

frequency f= 500 Hz

Peak value is +14V and -14V

Triangular wave oscillates between  7 V and - 7 V

### Example NO. 7.6, Page No: 336

In [6]:
#Variable Declaration:
Ri=10.0*10**3              #Resitance in ohm
Vp=10.0                    #Voltage in volt
Vref=10.0                  #Voltage in volt
fo=200.0                   #Frequency in hertz
Vi=2.0                     #Voltage in volt

#Calculations:
t=Vi/Vref
f=t/(Ri*C1)               #Calculating frequency

#Result:
print('Frequency f= %d Hz'%f)

Frequency f= 200 Hz

### Example No. 7.7, Page no: 345

In [7]:
# Answer in textbook is wrong
#Varible Declaration:
t=1*10**-3            #time in second

#Calculations:
R=t/(1.22*C)          #Calculating resistance value
R=R/1000              #Calculating resistance value

#Result:
print('R= %.1f kohm'% R)

R= 8.2 kohm

### Example No. 7.8, Page No: 351

In [8]:
#Variable Declaration:
D=20.0 # 20 percent            #Duty cycle
Ton=1.0*10**-3                 #On time period in seconds

#Calculatins:
Tonpoff=100.0*Ton/D            #Calculating total time period
Tonpoff1=Tonpoff*1000.0        #Calculating total time period
f=1/Tonpoff                    #Calculating frequency of oscillation

#Results:
print('Ton + Toff= %d ms'%Tonpoff1)
print('\nFrequency of oscillation= %d Hz'%f)

Ton + Toff= 5 ms

Frequency of oscillation= 200 Hz

### Example No. 7.9, Page No: 351

In [12]:
#Variable Declaration:
D=0.7                      #Duty cycle
f=1000.0                   #Frequency in hertz

RB=10.0**4/(6.43/3.0)  #Resistance value in ohm

#Calculations:
RA=4.0*RB/2.75              #Calculating resistance value
RB1=RB/1000.0                #Calculating resistance value
RA1=RA/1000.0                #Calculating resistance value

#Results:
print('RB= %.1f kohm'%RB1)
print('\nRA= %.1f kohm'%RA1)

RB= 4.7 kohm

RA= 6.8 kohm

### Example 7.10, Page No: 352

In [10]:
#Variable Declaration:
f1=1070.0                   #Frequency in hertz
RA=50000.0                  #Resistance in ohm
Rc=76.0#Standard Value      #Resistance in ohm

#Calculations:
t=1.45/(f1*C)
RB=(t-RA)/2                 #Calculating value of resistance
RB=RB/1000                  #Calculating value of resistance

#Results:
print('Assuming RA= 50 kohm and C= 0.01 uF')
print('\nHence, RB= %.2f kohm'%RB)
print('\nRc= %d ohm (Standard Value)'%Rc)

Assuming RA= 50 kohm and C= 0.01 uF

Hence, RB= 42.76 kohm

Rc= 76 ohm (Standard Value)