Magnetic field of coils

Profiles the magnetic field along a selectable curve for a helical (solenoidal or toroidal) current loop using the Biot-Savart law.
402 Downloads
Updated 9 Feb 2026

View License

Profiles the magnetic field along a selectable curve for a helical (solenoidal or toroidal) current loop using the Biot-Savart law. The Biot-Savart line integral is represented first symbolically in terms of a parametric path in three dimensions, then converted to a function of the parameter and integrated numerically. The results are compared to analytic results for an ideal solenoid or toroid.

Cite As

Duncan Carlsmith (2026). Magnetic field of coils (https://www.mathworks.com/matlabcentral/fileexchange/107874-magnetic-field-of-coils), 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.4

Spell check

1.0.3

Minor fix.

1.0.2

Added comparison of finite solenoidal coil axial field to ideal.

1.0.1

Minor fixes for single turn helices.

1.0.0