from __future__ import division
# given data
fo=1 #in KHz
# assume R1=1 Kohm and C=1 uF
R1=1 #in Kohm
C=1 #in uF
R2=1.16*R1 #in Kohm
R=1/(2*fo*10**3*C*10**-6)
print "Value of R1 = %0.2f kohm" %R1
print "Value of R2 = %0.2f kohm" %R2
print "Value of R = %0.2f ohm" %R
print "Value of C = %0.2f uF"%C
from math import log
# given data
fo=1 #in KHz
BETA=0.6 #unitless
print "As choosing R1=1 Kohm"
# assume R1=1 Kohm and C=1 uF
R1=1 #in Kohm
C=1 #in uF
R=1/(2*fo*10**3*C*10**-6*log((1+BETA)/(1-BETA)))
print "Value of R = %0.2f ohm"%R
#Answer in the book is wrong
# given data
BETA=0.41 #unitless
R=2.7 #in Kohm
C=0.1 #in uF
fo=1/(2*R*C*log((1+BETA)/(1-BETA))) #in KHz
print "Output signal frequency = %0.3f khz"%fo,
# given data
Ton=100 #in mSEC
Toff=200 #in mSEC
BETA=0.2 #unitless
#Let R1=1 Kohm
R1=1 #in Kohm
R2=R1*(1-BETA)/BETA #in Kohm
# Assuming C=10 uF
C=10 #in uF
R3=Ton*10**-3/(C*10**-6*0.41) #in Kohm
R4=Toff*10**-3/(C*10**-6*0.41) # in Kohm
print "Value of R1 = %0.2f kohm"%R1
print "Value of R2 = %0.2f kohm"%R2
print "Value of R3 = %0.2f kohm"%(R3/1000)
print "Value of R4 = %0.2f kohm"%(R4/1000)
print "Value of C = %0.2f uF"%C
# given data
Vo=7.5 #in Volt
fo=1 # in KHz
DutyCycle=60 #in %
Vz=6.8 # in volt
Vz1=6.8 # in volt
Vz2=6.8 # in volt
VD=0.7 # in volt
T=1/fo #in mSec
# duty cycle 60% gives Ton & Toff
Ton=0.6*T #in mSec
Toff=T-Ton #in mSec
# choosing R2=1.16*R1
R1=1 #in Kohm
C=0.1 #in uF
R2=1.16*R1 #in Kohm
R3=Ton*10**-3/(C*10**-6) #in ohm
R4=Toff*10**-3/(C*10**-6) #in ohm
print "Value of R1 = %0.2f kohm"%R1
print "Value of R2 = %0.2f kohm"%R2
print "Value of R3 = %0.2f kohm"%(R3/1000)
print "Value of R4 = %0.2f kohm"%(R4/1000)
print "Value of C = %0.2f uF"%C
# given data
RA=6.8 #in Kohm
RB=3.3 #in Kohm
C=0.1 #in uF
fo=1.45/((RA+2*RB)*C) # in KHz
d=(RA+RB)/(RA+2*RB)
print "Frequency of oscillation = %0.2f khz"%fo
print "Duty cycle = %0.2f %%" %(d*100)
# given data
fo=50 #in kHz
d=75/100 #unitless
C=1 #in nF
print "RA+2RB=28.9 kohm"
print "d=0.75=(RA+RB)/(RA+2*RB)"
print "It gives RA=2*RB"
RA=28.9/2 # in kohm
RB=RA/2 #in kohm
print "Value of RA = %0.1f kohm " %RA
print "Value of RB = %0.2f kohm " %RB
# given data
fo=800 # in Hz
d=60/100 #unitless
T=1/fo #in Sec
TC=0.6*T #in Sec
TD=T-TC #in Sec
C=0.01 #in uF
C2=10 #in uF
RB=TD/(0.69*C*10**-6) #in ohm
RA=(TC-0.69*RB*C*10**-6)/(0.69*C*10**-6) #in ohm
print "Value of RA = %0.2f kohm " %(RA/1000)
print "Value of RB = %0.2f kohm " %(RB/1000)
print "Value of C = %0.2f uF" %C
print "Value of C2 = %0.2f uF" %C2
# given data
fo=700 # in Hz
d=50/100 #unitless
T=1/fo #in Sec
TC=0.5*T #in Sec
TD=T-TC #in Sec
C=0.1 #in uF
RB=TD/(0.69*C*10**-6) #in ohm
RA=TC/(0.69*C*10**-6) #in ohm
print "Value of RA = %0.1f kohm " %(RA/1000)
print "Value of RB = %0.1f kohm " %(RB/1000)
print "We have TC = TD = %0.3f ms" %(TC*1000)
# given data
fo=1 # in KHz
d=40/100 #unitless
T=1/fo #in Sec
TC=0.4*T #in mSec
TD=T-TC #in mSec
C=0.1 #in uF
RB=TD*10**-3/(0.69*C*10**-6) #in ohm
RA=TC*10**-3/(0.69*C*10**-6) #in ohm
print "Value of RA = %0.2f kohm " %(RA/1000)
print "Value of RB = %0.2f kohm " %(RB/1000)
print "We have TC = %0.2f ms" %(TC)
print "We have TD = %0.2f ms" %(TD)
# given data
T=100 # in uSec
C=15 #in
R=T*10**-6/(1.1*C*10**-9) #in ohm
print "To obtain a output pulse at 100uSec resistor required = %0.2f kohm"%(R/1000)
#Note : in the question 15uF is given but in the solution 15nF is used in the book
# given data
VCC=15 #in Volt
T=10 #in mSec
ILED=20 #in mA
Vf=1.4 #in Volt
VBE=0.7 #in Volt
VCEsat=0.2 #in Volt
C=0.22 #in uF
R=T*10**-3/(1.1*C*10**-6) #in ohm
#output of the device
Vo=VCC-2*VBE-VCEsat
R5=(Vo-Vf)/(ILED*10**-3) #in ohm
print "Value of R = %0.2f kohm" %(R/1000)
print "Output of the device = %0.2f Volt" %(Vo)
print "Value of RB = %0.2f ohm" %(R5)
# given data
fo=2 # in KHz
C=0.01 #in uF
T=1/fo #in mSec
tp=1.2*T #in mSec
R=tp*10**-3/(1.1*C*10**-6) #in ohm
print "Period of trigger pulse = %0.2f ms" %(tp)
print "Value of R = %0.2f kohm"%(R/1000)
# given data
fo=2 # in KHz
Vopp=5 #in volts
Vsat=13 #in Volts
# Let the value of R2 used be 10 Kohm
R2=10 #in Kohm
R3=(2*R2*Vsat)/Vopp #in Kohm
# Let C1=0.1 uF
C1=0.1 # in uF
R1=R3/(4*fo*10**3*C1*10**-6*R2) # in ohm
print "Value of R1 = %0.2f kohm" %(R1/1000)
print "Value of C1 = %0.2f uF" %(C1)
print "Value of R2 = %0.2f kohm" %R2
print "Value of R3 = %0.2f kohm" %R3
# given data
Vcc=12 #in Volt
R1=10 #in Kohm
R2=100 #in Kohm
R3=820 #in Kohm
# Let Vsat=10 volt
Vsat=10 #in volt
# part (a)
Vopp=2*R2*Vsat/R3 #in Volt
print "Amplitude of triangular wave = %0.2f Volt" %(Vopp)
Vopp=Vsat-(-Vsat) # in Volt
print "Amplitude of square wave = %0.2f Volt" %(Vopp)
# part (b)
C1=0.1 # in uF
fo=R3*1000/(4*R1*1000*R2*1000*C1*10**-6) # in Hz
print "Frequency = %0.2f kHz" %(fo/1000)
from math import sqrt, pi
# given data
fo=1 # in KHz
# choose C=.01 uF
C=.01 # in uF
R=1/(2*pi*sqrt(6)*fo*1000*C*10**-6) # in ohm
R1=35.6 # in Kohm
RF=29*R1 #in ohm
print "Value of C = %0.2f uF" %(C)
print "Value of R = %0.2f kohm" %(R/1000)
print "Value of R1 = %0.2f kohm" %R1
print "Value of RF = %0.2f Mohm" %(RF/1000)
# Note : Answer in the book is wrong
from math import sqrt, pi
# given data
fo=1 # in KHz
# choose C=.01 uF
C=.01 # in uF
R=1/(2*pi*fo*1000*C*10**-6) # in ohm
# choosing R1=10 Kohm
R1=10 # in Kohm
RF=2*R1 #in Kohm
print "Value of C = %0.2f uF" %(C)
print "Value of R = %0.2f kohm" %(R/1000)
print "Value of R1 = %0.2f kohm" %R1
print "Value of RF = %0.2f kohm" %(RF)
# given data
R=1 #in Kohm
C=3.6 #in uF
fo=1/(2*pi*R*1000*C*10**-6) # in Hz
print "The frequency of oscillation = %0.2f Hz" %fo
# given data
R1=10 #in Kohm
R2=47 #in Kohm
R3=5.6 #in Kohm
RT=4.7 #in Kohm
CT=0.05 #in uF
V1=-10 #in Volt
V2=2 #in Volt
Vop=-(R1*V1/R2+R1*V2/R3) # in volt
VEE=0 #in Volt
I=(VEE+3-Vop)/RT # in mA
fo=0.32*I*10**-3/(CT*10**-6) #in Hz
print "Op-amp voltage = %0.2f V "%Vop
print "Frequency = %0.2f kHz" %(fo/1000)
# given data
RT=50 #in Kohm
CT=0.001 #in uF
V=20 #in Volt
C=10 #in uF
fo=0.25/(RT*10**3*CT*10**-6) #in Hz
dfl=7.8*fo/V #in Hz
dfc=sqrt(dfl/(2*pi*3.6*10**3*C*10**-6)) #in Hz
print "Free running frequency = %0.2f kHz" %(fo/1000)
print "Lock range = %0.2f kHz" %(dfl/1000)
print "Capture range = %0.2f Hz" %(dfc)
from math import log10, ceil
# given data
fomax=100 # in KHz
Resolution=2 #in Hz
flowest=Resolution #in Hz
fclk=fomax*2.2 #in KHz
# formula: 2**n=fclk/flowest
n=(log10(fclk*1000/flowest))/log10(2)
print " Frequency of reference oscillator = %0.2f kHz" %fclk
print " No. of bits needed is ",ceil(n)