Chapter 9 : Higher order circuits and Complex frequency

Example 9.6 Page No : 151

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

# Given
#resistance is 10ohm and inducmath.tance is 2H")
#Applied voltage is 10*exp(-2*t)*math.cos(10*t+30)")
#s = %s;
#For a RL circuit
#Applying KVL equation 
#v = i*R+L*d/dt(i)    (1)
#As v = 10(30 deg)    (2)
#Equating (1) and (2) 
# Let i = I*exp(s*t)    (3)
# 10(30 deg)*exp(s*t) = 10*I*exp(s*t)+2*s*I*exp(s*t)")
#Solving for I
#I = 10(30 deg)/10+2*s")
s = -2+1j*10
a = 10+2*s
x = 10*math.cos((30*math.pi)/180);
y = 10*math.sin((30*math.pi)/180);
z = complex(x,y)
I = z/a
b = I.real
c = I.imag
magn = math.sqrt(b**2+c**2)
ph = (math.atan(c/b)*180)/math.pi
#From (3)
print "i = %0.2f*exp-2*t)*math.cos10t%3.1f deg) A)"%(magn,ph);
i = 0.48*exp-2*t)*math.cos10t-43.3 deg) A)

Example 9.7 Page No : 156

In [3]:
import math 
#Example 9.7")

# Given
#resistance is 10ohm and capacitance is 0.2F")
#Applied voltage is 10*exp(-2*t)*math.cos(10*t+30)")
#s = %s;
#For a RC circuit
#Applying KVL equation 
#v = i*R+(1/C)*integrate(i*dt)    (1)
#As v = 10(30 deg)    (2)
#Equating (1) and (2) 
# Let i = I*exp(s*t)    (3)
# 10(30 deg)*exp(s*t) = 10*I*exp(s*t)+(5/s)*I*exp(s*t)")
#Solving for I
#I = 10(30 deg)/10+(5/s)")
s = -2+1j*10
a = 10+(5/s)
x = 10*math.cos((30*math.pi)/180);
y = 10*math.sin((30*math.pi)/180);
z = complex(x,y)
I = z/a
b = I.real
c = I.imag
magn = math.sqrt(b**2+c**2)
ph = (math.atan(c/b)*180)/math.pi
#From (3)
print "i = %0.2f*exp-2*t)*math.cos10t+%3.1f deg) A)"%(magn,ph);
i = 1.01*exp-2*t)*math.cos10t+32.8 deg) A)

Example 9.8 Page No : 161

In [13]:
import math 
from numpy import roots
from numpy.linalg import solve
#Example 9.8")

#s = %s ;

#From figure 9.13
#Z(s) = (2.5+((5*s/3)*(20/s))/(5*s/3+20/s))")
#On solving
z1 = roots([12, 8, 1])
z2 = roots([12 ,0, 1])

Z = 2.5*(z1/z2)
print "Z(s)",Z
#H(s) = I(s)/Z(s)
#Let I(s) = 1 the H(s) = 1/Z(s)
H = (1/2.5)*(z2/z1)
print "H(s)", H
Z(s) [ 0.+4.33012702j  0.-1.44337567j]
H(s) [ 0.-0.23094011j -0.+0.69282032j]

Example 9.9 Page No : 163

In [14]:
import math 
#Example 9.9")

# Calculation
#If s = 1Np/s
H1 = 0.4*(1.+12)/((1.+2)*(1+6))

# Results
print "H1) = %0.3f"%(H1)
H1) = 0.248

Example 9.11 Page No : 166

In [19]:
import math 
from numpy import roots

#From figure 9.16
#H(s) = V(s)/I(s) = Z(s)
#Let V(s) = 1 the H(s) = Z(s)
Z = [(1/2.5),(3/(5)),(s/20)]
#Dem = Z('den')
#The roots are
q = roots(Z)
print "Poles are", q
Poles are [ 0.87314228-0.71580545j -0.87314228+0.71580545j]