File Exchange

image thumbnail

Magnetic Flux distribution

version (4.24 KB) by Praviraj PG
Magnetic Flux distribution


Updated 12 Mar 2014

View License

These codes calculates & plots Magnetic Flux distribution for
1. Two parallel conductors,
2. Solenoid

Cite As

Praviraj PG (2020). Magnetic Flux distribution (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)

Koen Baron

The field is not changed, it only looks like that because of the normalization. Using smaller elements results in higher magnetic fields very close to the windings, hence relatively smaller values in the centre of the solenoid. Try plotting B without normalizing and you will see for yourself.

n g

this is not correct. even after implementing Jan's correction, changing N drastically changes the field distribution.

In solenoid.m it should be

ry = -yC(q); (with a minus sign)

Otherwise the fields are not calculated properly.

This is not FEM but Biot-Savart law. Good example anyway.

Dear Dr. Pravi (or any other interested users), I would appreciate your help.

I am an electrical engineer student at McGill University, and I am very happy that you posted very nice and working algorithms for FEM simulations. I am trying to use your matlab script solenoid.m to simulate a solenoid, but for my simulation I would need to add an iron core inside the loops, I found online (see sources) that mathematicly this change in permeability ends up scaling the field by a constant. Do you think this is applicable somewhere in your code? I fould this mathematical scaling being too easy to be true in my mind it's seem pretty clear that some border effect woul happen at the core extremety, because of the iron-air interface, what do you think?

There is other things I would like to know in order to understand my eventual results, does the length values (such as: d = 2; % Radius of the Loop...) are indcated in meter units ? Also the direction of the current is taken in consideration, but not its amplitude? I know that if I put -10 instead of -1 (as default) it scale B by 10, so can I consider this as being Ampere unit? Finally, At the end of the magnetic field computation, if I put as comment the normalization line at the end, the resulting unit of the fields B are suposed to be Tesla ?

Thanks for your time and help!



Title updated.

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