from math import pi
import numpy as np
#Variable declaration
N = 3 #Piecewise sinusoidal dipole modes (unitless)
l = 1/10.0 #Dipole length (lambda)
z11_exact = 0.4935 - 3454j #Exact impedence vector(ohm)
z11_apprx = 0.4944 - 3426j #approximate impedence vector(ohm)
z12_exact = 0.4935 + 1753j #Exact impedence vector(ohm)
z12_apprx = 0.4945 + 1576j #approximate impedence vector(ohm)
z13_exact = 0.4935 + 129.9j #Exact impedence vector(ohm)
z13_apprx = 0.4885 + 132.2j #approximate impedence vector(ohm)
#Calculations
N2 = N + 1 #Number of equal segments (unitless)
d = l/4 #Length of each segment (lambda)
Rmn = 20*(2*pi*d)**2 #Real part of elements of Z-matrix, Zmn (VA)
zmat_apprx = np.array([[(z11_apprx+z13_apprx), z12_apprx],
[2*z12_apprx, z11_apprx]])
#Z(impedence) matrix (unitless)
vmat = np.array([0,1]) #Voltage matrix (unitless)
i1,i2 = np.linalg.solve(zmat_apprx,vmat) #Current matrix (unitless)
i_ratio = i2/i1 #Current ratio (unitless)
zin = vmat[1]/i2 #Input impedence (ohm)
zmat_exact = np.array([[(z11_exact+z13_exact), z12_exact],
[2*z12_exact, z11_exact]])
i1_e,i2_e = np.linalg.solve(zmat_exact,vmat) #Current matrix (unitless)
i_ratio_exact = i2_e/i1_e #Current ratio (unitless)
zin_exact = vmat[1]/i2_e #Input impedence (ohm)
#Result
print "The current ratio is ", np.around(i_ratio,4)
print "This is nearly equal to 1.9," \
"indicating a nearly triangular current distribution"
print "The input impdence is ", np.around(zin,3), "ohm using approximate values"
print "The input impedence is ", np.around(zin_exact,3), "ohm using exact values"
from math import tan, pi
import numpy as np
#Variable declaration
z_load = 2.083 + 1605j #conjugate matched load (ohm)
e0 = 1.0 #Electric field magnitude (unitless)
l = 1/10.0 #length of dipole (lambda)
imag = 0+1j #Imaginary number
z11_exact = 0.4935 - 3454j #Exact impedence vector(ohm)
z11_apprx = 0.4944 - 3426j #approximate impedence vector(ohm)
z12_exact = 0.4935 + 1753j #Exact impedence vector(ohm)
z12_apprx = 0.4945 + 1576j #approximate impedence vector(ohm)
z13_exact = 0.4935 + 129.9j #Exact impedence vector(ohm)
z13_apprx = 0.4885 + 132.2j #approximate impedence vector(ohm)
#Calculation
d = l/4 #Length of each segment (lambda)
vm = (2*e0/(2*pi))*tan(2*pi*d/2) #Voltage vector (VA)
z22 = z11_exact + z_load #Impedence matrix for loaded dipole (VA)
zmat_exact = np.array([[(z11_exact+z13_exact), z12_exact],
[2*z12_exact, z22]])
#Z(impedence) matrix (unitless)
vmat = np.array([vm,vm]) #Voltage matrix (unitless)
i1,i2 = np.linalg.solve(zmat_exact,vmat) #Current matrix (unitless)
i3 = i1 #Current vector (unitless)
e_zn = (60*tan(2*pi*d/2))*imag #Free space electric field (V/m)
e_s = i1*e_zn + i2*e_zn + i3*e_zn #Scattered field (V/m)
sigma = 4*pi*(abs(e_s)**2)/(abs(e0)**2) #Radar Cross section (lambda**2)
#Result
print "The radar cross section using exact values of Z matrix is", round(sigma,4),\
"lambda^2"
import numpy as np
#Variable declaration
z11_exact = 2-1921j #Exact impedence vector (ohm)
z12_exact = 1.9971-325.1j #Exact impedence vector (ohm)
z11_apprx = 1.9739-1992j #Approximate impedence vector (ohm)
z12_apprx = 1.9739-232.8j #Approximate impedence vector (ohm)
vmat = np.array([1,0])
#Calculations
zmat_exact = np.array([[z11_apprx, z12_apprx],
[z12_apprx, z11_apprx]])
#Impedence matrix (unitless)
i1,i2 = np.linalg.solve(zmat_exact,vmat)
#Current matrix (unitless)
zin = 1/i1
#Result
print "The input impedence for order N = 2 is", np.around(zin,3), "ohm"