Magnetic Field of Bar Magnet

Calculates the magnetic field in an air gap between poles tips of long uniformly magnetized cylinders.
57 Downloads
Updated 9 Feb 2026

View License

Calculates the magnetic field in an air gap between poles tips of long uniformly magnetized cylinders numerically using a monopole surface charge density approach and compares to a point-like magnetic monopole approximation.

Cite As

Duncan Carlsmith (2026). Magnetic Field of Bar Magnet (https://www.mathworks.com/matlabcentral/fileexchange/108009-magnetic-field-of-bar-magnet), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2021b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Version Published Release Notes
1.01

Added interactive_examples tag

1.0.2

Spell check

1.0.1

Added a visualization.

1.0.0