Magnetic field from a coil (on Mathematica)

  • #1
402
1

Main Question or Discussion Point

Hello guys,

I'm trying to find the configuration of two circular coils in a configuration similar to Helmholtz coils that would homogenize the magnetic field best at a volume between them.

So the first thing step I took in that is use the Biot-Savart law to calculate the magnetic field produced at each point through that coil. The coordinate system is Cylinderical coordinates, and the coil is placed on the xy-plane, its center matches the origin (0,0,0).

The function is

[itex]
\begin{array}{l}
dl = \sqrt {d{x^2} + d{y^2}} = Rd\theta \\
B\left( {\overrightarrow r } \right) = \frac{{{\mu _0}I}}{{4\pi {R^3}}}\int\limits_0^{2\pi } {\left( {\overrightarrow {dl} \times \left( {\overrightarrow r - \overrightarrow R } \right)} \right)d\theta } \\
B\left( {x,y,z} \right) = \frac{{{\mu _0}I}}{{4\pi {R^3}}}\int\limits_0^{2\pi } {\left( {\left( { - R\sin \theta ,R\cos \theta ,0} \right) \times \left( {x - R\cos \theta ,y - R\sin \theta ,z} \right)} \right)d\theta }
\end{array}[/itex]

where r(x,y,z) is the position vector from origin to the point, at which the magnetic field is to be calculated; R is the radius of the coil.

I wrote a Mathematica script to do this integral, but it always gives a single number (representing a 2 pi R^2 constant result from the cross product and the integral), no matter how I change x,y and z. This is the function I'm using.

FieldAtPoint[x_, y_, z_] :=
(u0 i)/(4 Pi r^2)
Integrate[
Cross[r{-Sin[t], Cos[t], 0}, ({x - r Cos[t], y - r Sin[t], z})], {t,
0, 2 Pi}]
Do you find anything wrong within my calculations? Please advise. How do I do this correctly?

Thank you for any efforts.
 
Last edited:

Answers and Replies

  • #2
984
173
You need this term in the denominator: |x(obs) - x(coil)|3

The R3 term is an error -- it's |x(coil)|3
 
  • #3
402
1
@lpetrich Thanks a lot! what a stupid mistake!
 

Related Threads on Magnetic field from a coil (on Mathematica)

  • Last Post
Replies
1
Views
2K
Replies
17
Views
9K
  • Last Post
Replies
3
Views
3K
Replies
3
Views
8K
  • Last Post
Replies
5
Views
2K
Replies
1
Views
506
Replies
3
Views
2K
  • Last Post
Replies
11
Views
22K
Replies
4
Views
485
Top