# Calculate Magnetic field using Ampère's law

Tags:
1. Aug 12, 2015

### Miss_Fire

1. The problem statement, all variables and given/known data
I have an assignement in school. The statement is: chose a distribution of electric curents for which you can calculate easily the magnetic field (for example, using Ampère's law). Describe your distribution and explain the way you calculate the magnetic field.

2. Relevant equations

3. The attempt at a solution
I think that I have to find H. For example, if i chose k=1 (one electric current), and a value for I_1 then i'll have to calculate H from the first integral, but I don't know how. This is just my opinion, I'm not even sure if those are the right equations to solve this because the statement seems a little bit vague to me and I'm unfamiliar with this topic.

2. Aug 12, 2015

### Hesch

An example: Say you have some toroid:

Amperes law states that if you choose some (closed) circulation path ( blue dotted circle ), the mean value of H can be calculated from:

circulation H⋅ds = N*I ( s is lenght of the path, N is the number of turns ( 18 ) ). N*I is the amount of current that passes through an area, surrounded by the circulation path. This includes separated currents passing in separated coils/wires. So if you choose r > b ( or r < a ), H will be zero, because the summed amount of current through that surrounded area will be zero.

Here H is constant (symmetrical reasons), so it could be written: H*∫ ds = N*I → H * 2πr = N*I → H = (N*I) / 2πr

B = μH → B = μ(N*I) / 2πr

Amperes law is also used to calculate mean H-fields within transformers, solenoids, etc. If a H-field in an exact location is to be calculated, Biot-Savart must be used. But Amperes law is very efficient, calculating cases with some symmetry included.

Last edited: Aug 12, 2015
3. Aug 12, 2015

### Miss_Fire

Thank you for your explanation! I have one more question: I need to represent this magnetic field in Octave. We generally use the quiver function: quiver(X,Y,U,V) draws vectors at each pair of elements in X and Y. If X and Y are vectors, length(X)=n and length(Y)=m, where [m,n]=size(U)=size(V). The vector X corresponds to the columns of U and V, and vector Y corresponds to the rows of U and V. According to your formula (B = μ(N*I) / 2πr), I need somehow to vary the value of some parameters in RHS of the equation, so I can calculate the value of B in different conditions (I suppose that the radius or intensity or both of them should be varied).

4. Aug 12, 2015

### Miss_Fire

PS: we use the linspace function to get equidistant points in an interval or the meshgrid function.