Chapter 8 : First order Circuits

Example 8.1 Page No : 139

In [1]:
import math 
#Example 8.1")

# Given
#capacitance is 1uF")
#resistance is 1Mohm")
#Voltage across capacitor is 10V")
R = 1*10**6;
C = 1*10**-6;
V = 10
#Let T be time consmath.tant
T = R*C
#v(t) = V*exp(-t/T)
#v(t) = 10*exp(-t)      (1)")
#Substituting value of t = 5 in (1)
v5 = 10*math.exp(-5)

# Results
print "Time constant is %ds"%(T)
print "v5) = %0.3fV"%(v5)
Time constant is 1s
v5) = 0.067V

Example 8.10 Page No : 142

In [2]:
import math 
#Example 8.10")

# Given
#vs =  5V         t<0")
#vs = 5*math.sin(w*t)  t>0")
vs = 5;
R = 5;
L = 10*10**-3;
#At t<0

# Calculation and Results
#Inductor behaves as a short circuit
#Let i(0-) = i
i = vs/R;
print "i0-) = %dA"%(i)
#During the transition from t = 0- to t = 0+
#Let i(0+) = i1
i1 = i
print "i0+) = %dA"%(i1)
#Applying KVL equation to the loop
#vs = i*R+v")
#Let v(0+) = v1 ; vs(0+) = vs1
#From given vs(0+) = 0
vs1 = 0;
v1 = vs1-i*R
print "v0+) = %dV"%(v1)
i0-) = 1A
i0+) = 1A
v0+) = -5V