Illustrates ways to numerically calculate and visualize the electric field and electric potential of charge distributions in 3D.
Updated 28 Jul 2022

View License

This script calculates the electric field and potential within a volume of space due to stacks of rings of point charges, rings sharing a common axis (the z-axis). The point charge density on the rings may be modulated and the ring density may be varied to represent the fields of charge distributions that are discrete of continuous in azimuth or height. Thusly, the user can explore arrays of line charges and tubes withe constant or variable charge density.
Once the charge distribution is set up, the potential and electric fields are calculated in two ways, using MATLAB vectorized methods and using a loop structure, to explore the computation time difference. Visualization techniques include surface plots of the potential and quiver plots of the vector field in sectional planes within the volume.
This script is designed as a tutorial for physics students and contains a variety of Try this suggestions for exploration entailing simple changes in parameter values, and some suggestions for coding extensions at the end. Many of the functions used are hyperlinked to MATLAB documentation for ready reference.

Cite As

Duncan Carlsmith (2024). ElectricFieldsOfChargeDistributionsIn3d (https://www.mathworks.com/matlabcentral/fileexchange/110140-electricfieldsofchargedistributionsin3d), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2022a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!


Version Published Release Notes

Spell check