Poynting Vector of Half-Wave Antenna

  • PROGRAM: Poynting vector of half-wave antenna
  • CREATED: 5/30/2018

Import packages.


In [1]:
import numpy as np
import matplotlib.pylab as plt

In this problem, I plot the magnitude of the time averaged Poynting vector for a half-wave antenna. The antenna is oriented vertically in this problem.

  • In step 1, I define constants in the problem.
    • $\mu_{0}$ is the permeability of free space.
    • $c$ is the speed of light.
    • $I_{0}$ is the magnitude of the current. I've chosen it to be 5 A.
  • In step 2, I define a function to calculate the time averaged Poynting vector magnitude, $<S> = (\frac{\mu_{0} c I_{0}^{2}}{8\pi^{2}r^{2}})\frac{cos^2(\frac{\pi}{2}cos\theta)}{sin^2\theta}$.
  • In step 3, I plot the Poynting vector (represented by a point at the tip of the Poynting vector) at different angles around the half-wave antenna, one meter from the antenna.
  • In step 4, I plot the Poynting vector at one meter, two meters, and three meters from the antenna. Its strength (magnitude, or length of vector) decreases.
  • In step 5, I plot the Poynting vector at different radii as a vector field. This is another way to see that its strength decreases farther from the antenna, and that it is strongest at angles close to 90 degrees and 270 degrees.

1 - Define Constants


In [2]:
#Define constants - permeability of free space, speed of light, current amplitude.
u_0 = 1.26 * 10**(-6)
c = 2.997925 * 10**8
I_0 = 5
#Choose any current amplitude value, I_0.

2 - Calculate Time Averaged Poynting Vector


In [3]:
def S_avg(x, r):
    return (u_0 * c * I_0**2)/(8 * np.pi * r**2) * np.cos(np.pi/2 * np.cos(x))**2/np.sin(x)**2

3 - Plot Poynting Vector at Different Angles Around Antenna


In [4]:
#Plot average Poynting vector magnitude at different angles.
fig = plt.figure(figsize = (8, 8))
ax = fig.add_subplot(1, 1, 1, projection = 'polar')

#Define a range of angles.
theta = np.arange(0, 2 * np.pi, 0.01)

#Plot Poynting vector magnitude at different radii.
ax.plot(theta, S_avg(theta, r = 1), color = 'red', label = 'r = 1')

#Plot an example vector.
x = 0
y = 0
u = S_avg(np.pi/3, r = 1) * np.sin(np.pi/3)
v = S_avg(np.pi/3, r = 1) * np.cos(np.pi/3)
ax.quiver(x, y, u, v,  scale_units = 'xy', scale = 0.5, color = 'red')

#Adjust plot labels.
ax.set_rticks([100, 200, 300])
ax.set_rlabel_position(0)
ax.grid(True)

#Flip plot axes to match antenna position from notes.
ax.set_theta_offset(np.pi/2)
ax.set_theta_direction(-1)

#Add title.
ax.set_title('Time Average of Poynting Vector at Different Angles Around Antenna, \n One Meter Away', fontsize = 16, verticalalignment = 'bottom')

plt.legend(title = 'Radius in Meters', loc = [0.91, 0.91])
plt.tight_layout()

plt.show()


/Applications/Programming/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py:2: RuntimeWarning: divide by zero encountered in true_divide
  

3 - Plot Poynting Vector Magnitude at Different Angles Around Antenna for Different Distances from Origin


In [5]:
#Define a range of angles.
theta = np.arange(0, 2 * np.pi, 0.01)

def S_avg(x, r):
    return (u_0 * c * I_0**2)/(8 * np.pi * r**2) * np.cos(np.pi/2 * np.cos(x))**2/np.sin(x)**2

#Plot average Poynting vector magnitude at different angles.
fig = plt.figure(figsize = (8, 8))
ax = fig.add_subplot(1, 1, 1, projection = 'polar')

#Plot Poynting vector magnitude at different radii.
ax.plot(theta, S_avg(theta, r = 1), color = 'red', label = 'r = 1')
ax.plot(theta, S_avg(theta, r = 2), color = 'blue', label = 'r = 2')
ax.plot(theta, S_avg(theta, r = 3), color = 'purple', label = 'r = 3')

#Plot an example vector.
theta = np.pi/3
x = 0
y = 0
u = S_avg(theta, r = 1)
v = 0
ax.quiver(x, y, u*np.sin(theta), u*np.cos(theta), scale_units = 'xy', scale = 0.5, color = 'red')

#Adjust plot labels.
ax.set_rticks([100, 200, 300])
ax.set_rlabel_position(90)
ax.grid(True)

#Flip plot axes to match antenna position from notes.
ax.set_theta_offset(np.pi/2)
ax.set_theta_direction(-1)

#Add title.
ax.set_title('Time Average of Poynting Vector at Different Angles Around Antenna', fontsize = 16, verticalalignment = 'bottom')

plt.legend(title = 'Radius in Meters', loc = [0.91, 0.91])
plt.tight_layout()

plt.savefig('Time Average of Poynting Vector at Different Angles Around Antenna.png')
plt.show()


/Applications/Programming/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py:5: RuntimeWarning: divide by zero encountered in true_divide
  """

In [6]:
def S_avg(x, r):
    return (u_0 * c * I_0**2)/(8 * np.pi * r**2) * np.cos(np.pi/2 * np.cos(x))**2/np.sin(x)**2

#Plot average Poynting vector magnitude at different angles.
fig = plt.figure(figsize = (8, 8))
ax = fig.add_subplot(1, 1, 1, projection = 'polar')

meters = 1

n = 36
theta = np.linspace(0, 2 * np.pi , n)
r = np.linspace(meters, meters, 1)

X, Y = np.meshgrid(theta, r)
u = S_avg(X,Y)
v = 0

ax.quiver(X, Y, u*np.sin(X), u*np.cos(X), color = 'red', width = 0.005)

#Adjust plot labels.
ax.set_rticks([1, 2, 3, 4])
ax.set_rlabel_position(90)
ax.grid(True)

#Flip plot axes to match antenna position from notes.
ax.set_theta_offset(np.pi/2)
ax.set_theta_direction(-1)

#Add title.
ax.set_title('Time Average Poynting Vector at Different Angles Around Antenna', fontsize = 16, verticalalignment = 'bottom')

#plt.savefig('Time Average Poynting Vector at One Meter from Antenna.png')
plt.show()


/Applications/Programming/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py:2: RuntimeWarning: divide by zero encountered in true_divide
  
/Applications/Programming/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py:18: RuntimeWarning: invalid value encountered in multiply