Visualization of Electromagnetic Fields Using Gnuplot
Somnath Datta
Prof of Physics (retired), NCERT
Gnuplot provides an excellent tool for plotting electromagnetic fields from various sources of electric charges and currents, stationary as well as time-varying. Its extraordinary power can be particularly exploited in plotting the propagating electromagnetic field from a localized source, e.g., an oscillating electric or magnetic dipole. In this article we have written the explicit commands in Gnuplot which will draw the E field lines of the electromagnetic field due to a harmonically oscillating electric dipole aligned with the Z axis. We have plotted the E field lines on the XZ plane over a limited region of radius 2.2 wavelengths around the source. We have shown, side by side, the B field lines from the same source. The plotting of the E field involves plotting a 3D ``relief map'' with contours embedded on it, for a certain function ψ(x,y,z,t), with t held constant. The contour levels are selected by applying certain criteria. The plotted contours are converted to directed contours, by drawing arrowheads on them, indicating the direction of the E field, so that they qualify as field lines. We have demonstrated two alternative methods of adding this qualification. namely (a) planting the E field vectors at selected points on the XZ plane, and extrapolating them to the contour lines; (b) plotting the θ-component along the X-axis, its positive value implying E pointing in the negative Z direction and vice versa, and then following this direction around the entire contour. We have worked out method (a) only for t=0; and method (b) for one full cycle of oscillation corresponding to eight values of t spaced at equal intervals. Looking at these eight plots sequentially one sees how the electromagnetic field is propagating across space. At the end we have used Gnuplot to plot the E