import math
import numpy
%matplotlib inline
from matplotlib.pyplot import plot,title,xlabel,ylabel
#Variables
VCC = 10.0 #Supply voltage (in volts)
VBB = 5.0 #Voltage across base (in volts)
RC = 200.0 #Collector resistance (in ohm)
#Calculation
#Upper end point
ic = VCC / RC #Collector current (in Ampere)
VCE = VCEsat = 0 #Collector-to-emitter voltage (in volts)
#lower cut-off point
ic1 = 0 #Collector current (in Ampere)
VCE1 = VCC #Collector-to-emitter voltage (in volts)
#Result
print "The upper end point is ic = ",ic * 10**3," mA.\nThe lower end point is VCE = ",VCE1," V."
#Graph
x = numpy.linspace(0,VCE1,100)
plot(x,ic*10**3 - ic*10**3/VCE1*x)
title("d.c. load line")
xlabel("Collector-to-emitter voltage VCE (V)")
ylabel("Collector current IC (mA)")
import math
#Variables
R1 = R2 = R = 20.0 * 10**3 #Resistance (in ohm)
C1 = C2 = C = 100.0 * 10**-12 #Capacitance (in Farad)
#Calculation
f = 1/(1.38 * R * C) #Frequency (in Hertz)
#Result
print "Frequency of oscillation is ",round(f * 10**-3)," kHz."
import math
#Variables
R1 = 2.0 * 10**3 #Resistance (in ohm)
R2 = 20.0 * 10**3 #Resistance (in ohm)
C1 = 0.01 * 10**-6 #Capacitance (in Farad)
C2 = 0.05 * 10**-6 #Capacitance (in Farad)
#Calculation
T = 0.69*(R1*C1 + R2*C2) #Time periode of oscillation (in seconds)
f = 1/T #Frequency of oscillation (in Hertz)
#Result
print "Time period of oscillation is ",round(T * 10**3,1)," ms.\nFrequency of oscillation is ",round(f * 10**-3,2)," kHz."
#Slight variation due to higher precision.
import math
#Variables
T1 = 1.0 * 10**-6 #Pulse width (in seconds)
f = 100.0 * 10**3 #Frequency (in Hertz)
R1 = R2 = 10.0 * 10**3 #Resistance (in ohm)
#Calculation
T = 1/f #Time period of oscillation (in seconds)
C1 = T1 / 0.69 / R1 #Capacitance (in Farad)
T2 = T - T1 #Time period (in seconds)
C2 = T2 / 0.69 / R2 #Capacitance (in Farad)
#Result
print "Value of C1 capacitor is ",round(C1 * 10**12)," pico-Farad.\nValue of C2 capacitor is ",round(C2 * 10**12)," pico-Farad."
import math
#Variables
T2A = 310.0 * 10**-6 #Time period (in seconds)
T2B = 250.0 * 10**-6 #Time period (in seconds)
VCC = 15.0 #Supply voltage (in volts)
ICsat = 5.0 * 10**-3 #Saturated collector current (in Ampere)
hFEmin = 20.0 #Current gain
#Calculation
RC = VCC / ICsat #Collector resistance (in ohm)
RC1 = RC2 = RC #Collector resistance of transistors Q1 and Q2 (in ohm)
IBsat = ICsat / hFEmin #Saturated Base current (in Ampere)
IB = 2 * IBsat #Base current (in Ampere)
R1 = R2 = R = VCC / IB #Resistance (in ohm)
C1 = T2A / 0.69 / R1 #Capacitance (in Farad)
C2 = T2B / 0.69 / R2 #Capacitance (in Farad)
t1 = R1 * C1 #Time constant1 (in seconds)
t2 = R2 * C2 #Time constant2 (in seconds)
t11 = RC1 * C1 #Time constant (in seconds)
t12 = RC1 * C2 #Time constant (in seconds)
#Result
print "Rc : ",RC," ohm.\nRC1 : ",RC1," ohm.\nIBsat : ",IBsat," A.\nIB : ",IB," A.\nR1 : ",R1*10**-3," kilo-ohm.\nR2 : ",R2*10**-3," kilo-ohm.\nC1 : ",round(C1 * 10**12)," pico-Farad.\nC2 : ",round(C2*10**12)," pico-Farad."
print "Output waveform time constants :\nt1 = ",round(t1 * 10**6,1)," micro-second.\nt2 : ",round(t2 * 10**6,1)," micro-second\nt11 : ",round(t11 * 10**6,1)," micro-second\nt12 : ",round(t12 * 10**6,1)," micro-second."
#In some places milli seconds is mentioned in place of micro second in book.
import math
#Variables
f = 20.0 * 10**3 #Frequency (in Hertz)
tp = 5.0 * 10**-6 #Pulse duration (in seconds)
#Calculation
T = 1/f #Time period (in seconds)
duty_cycle = tp / T #Duty cycle of monostable multivibrator
#Result
print "The duty cycle of the waveform at the output (Q) of the monostable multivibrator is ",duty_cycle * 100,"%."
import math
#Variables
f = 100.0 * 10**3 #Frequency (in Hertz)
C1 = 0.001 * 10**-6 #Capacitance (in Farad)
#Calculation
duty_cycle = 0.5 #Duty cycle
T = 1/f #Time period (in seconds)
tp = duty_cycle * T #Pulse width (in seconds)
R3 = tp / 0.69 / C1 #Resistance (in ohm)
#Result
print "Value of R3 is ",round(R3 * 10**-3,3)," kilo-ohm and value of C1 is ",C1 * 10**9," nF."
import math
#Variables
R1 = 2.2 * 10**3 #Resistance (in ohm)
C1 = 0.01 * 10**-6 #Capacitance (in Farad)
#Calculation
tp = 1.1 * R1 * C1 #Pulse width (in seconds)
#Result
print "The pulse width is ",tp * 10**6," micro-second."
import math
#Variables
C = 1000.0 * 10**-12 #Capacitance (in Farad)
tp = 10.0 * 10**-6 #Pulse width (in seconds)
T = 60.0 * 10**-6 #time period (in seconds)
#Calculation
R1 = tp / (1.1 * C) #Resistance (in ohm)
#Result
print "Resistance required is ",round(R1 * 10**-3,2)," kilo-ohm."
import math
#Variables
R1 = 6.8 * 10**3 #Resistance (in ohm)
R2 = 4.7 * 10**3 #Resistance (in ohm)
C1 = 1000.0 * 10**-12 #Capacitance (in Farad)
#Calculation
t2 = 0.7 * R2 * C1 #Time interval2 (in seconds)
t1 = 0.7 * (R1 + R2 ) * C1 #Time interval1 (in seconds)
T = t1 + t2 #Total time (in seconds)
duty_cycle = t1 / T * 100 #Duty cycle of the waveform
#Result
print "t1 is ",t1 * 10**6," micro-seconds.\nt2 is ",t2 * 10**6," micro-seconds.\nDuty cycle is ",round(duty_cycle),"%."
import math
#Variables
R1 = 27.0 * 10**3 #Resistance (in ohm)
R2 = 56.0 * 10**3 #Resistance (in ohm)
C1 = 0.01 * 10**-6 #Capacitance (in Farad)
#Calculation
t2 = 0.7 * R2 * C1 #Time interval2 (in seconds)
t1 = 0.7 * (R1 + R2 ) * C1 #Time interval1 (in seconds)
T = t1 + t2 #Total time (in seconds)
f = 1 / T #Frequency (in Hertz)
duty_cycle = t1 / T * 100 #Duty cycle of the waveform
#Result
print "Frequency is ",round(f * 10**-3,2)," kHz.\nDuty cycle is ",round(duty_cycle),"%."
#In book it forgot to mention the duty_cycle.
import math
#Variables
f = 50.0 * 10**3 #Frequency (in Hertz)
duty_cycle = 0.6 #Duty cycle
C = 0.0022 * 10**-6 #Capacitance (in Farad)
#Calculation
T = 1/f #Time period (in seconds)
t1 = duty_cycle * T #time interval1 (in seconds)
t2 = T - t1 #time interval2 (in seconds)
R2 = t2 / (0.7 * C ) #Resistance (in ohm)
R1 = t1 / (0.7 * C) - R2 #Resistance (in ohm)
#Result
print "Time period is ",T * 10**3,"ms.\nt1 is ",t1 * 10**3," ms.\nt2 is ",t2 * 10**3," ms.\nR2 is ",round(R2 * 10**-3,2)," kilo-ohm.\nR1 is ",round(R1 * 10**-3,1)," kilo-ohm."