0
$\begingroup$

I need to plot some electric and magnetic fields in 3D. Can anyone recommend a good program - something easy where I can just insert the vector field components?

Edit: I am plotting the E and B fields of a circularly polarized (finite) wave packet. I can provide the x, y, and z components of the vector field - I want to plot (draw) either a vector field with arrow length corresponding to field magnitude, or flow lines (field lines).

The other posts referenced do not provide assistance with this. This is not a duplicate question.

$\endgroup$
4

2 Answers 2

0
$\begingroup$

You can use matplotlib

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

x = np.linspace(-5, 5, 10)
y = np.linspace(-5, 5, 10)
z = np.linspace(-5, 5, 10)
X, Y, Z = np.meshgrid(x, y, z)

U = X
V = Y
W = Z

ax.quiver(X, Y, Z, U, V, W, length=0.5, normalize=True)

ax.set_xlabel('X-axis')
ax.set_ylabel('Y-axis')
ax.set_zlabel('Z-axis')

plt.show()
$\endgroup$
0
$\begingroup$

Mathematica is an excellent software to full fill your needs. The manual of Mathematica will satisfy all your curiosity regarding plotting.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.