Chapter 8: Integral Equations, Moment Method and Self and Mutual impedances

Example 8.1, Page no. 438

In [36]:
import numpy as np
import matplotlib.pyplot as plt

#given
a=0.001
delta=0.2
N=5
epsilon=8.854*10**-12
V_m=4*pi*epsilon

z=np.zeros([N,N])
b=np.zeros(N)

for i in range(0,N):
    b[i]=V_m

def m_eq_n(d,a):
    temp=2*log(((d/2.0)+sqrt((a**2)+((d/2)**2)))/(a))
    return temp

def m_less(m,n,d,a):
    l_m=abs(d*n-d*m)
    d_mn_p=l_m+d/2
    d_mn_n=l_m-d/2
    
    temp=log((d_mn_p+(d_mn_p**2+a**2)**(0.5))/(d_mn_n+(d_mn_n**2+a**2)**(0.5)))
    return temp

def m_grt(m,n,d,a):
    l_m=abs(d*n-d*m)
    d_mn_p=l_m+d/2
    d_mn_n=l_m-d/2
    
    temp=log(d_mn_p/d_mn_n)
    return temp

for i in range(0,N):
    for j in range(0,N):
        if i==j:
            z[i][j]=m_eq_n(delta,a)
        elif abs(i-j) <= 2:
            z[i][j]=m_less(i,j,delta,a)
        else:
            z[i][j]=m_grt(i,j,delta,a)
print "The Z-matrix is:"
print z

print "The Vm matrix is:"
print b

a=np.linalg.solve(z,b)
print "Charge distribution:\n"
for i in range(0,N):
    print "a%d:"%i,a[i]*10**12,"pC/m"
    
m=np.linspace(0,1,11)
C=np.zeros(N*2+1)
i=j=0
while j<5 and i<10:
    C[i]=a[j]*10**12
    C[i+1]=a[j]*10**12
    i=i+2
    j=j+1
print C


plt.plot(m,C)
plt.xlabel("Length(m)")
plt.ylabel("Charge Density(pC/m)")
plt.axis([0.0,1.0,7,10])
plt.show()
The Z-matrix is:
[[ 10.59668473   1.09859007   0.51082385   0.33647224   0.25131443]
 [  1.09859007  10.59668473   1.09859007   0.51082385   0.33647224]
 [  0.51082385   1.09859007  10.59668473   1.09859007   0.51082385]
 [  0.33647224   0.51082385   1.09859007  10.59668473   1.09859007]
 [  0.25131443   0.33647224   0.51082385   1.09859007  10.59668473]]
The Vm matrix is:
[  1.11262645e-10   1.11262645e-10   1.11262645e-10   1.11262645e-10
   1.11262645e-10]
Charge distribution:

a0: 8.81086751577 pC/m
a1: 8.08998670069 pC/m
a2: 7.97286010025 pC/m
a3: 8.08998670069 pC/m
a4: 8.81086751577 pC/m
[ 8.81086752  8.81086752  8.0899867   8.0899867   7.9728601   7.9728601
  8.0899867   8.0899867   8.81086752  8.81086752  0.        ]

Example 8.6, Page no. 474

In [1]:
Z11 = 73 + 42.5j
Z12 = 25-38j

Z_1d = Z11 + Z12

print 'Z1d:',Z_1d
Z1d: (98+4.5j)
In [ ]: