Implementation of the analytical expression for the magnetic field ... (2024)

19 views (last 30 days)

Show older comments

Florian G on 2 Aug 2024 at 6:53

  • Link

    Direct link to this question

    https://www.mathworks.com/matlabcentral/answers/2142316-implementation-of-the-analytical-expression-for-the-magnetic-field-of-a-circular-current-loop-and-in

  • Link

    Direct link to this question

    https://www.mathworks.com/matlabcentral/answers/2142316-implementation-of-the-analytical-expression-for-the-magnetic-field-of-a-circular-current-loop-and-in

Answered: Alan Stevens on 2 Aug 2024 at 8:48

Open in MATLAB Online

I want to analytically approximate the magnetic field of a few coil arrangements. For this purpose i found a very helpful paper: 20140002333.pdf (nasa.gov). On page 8 of the PDF document are the analytic expressions for the field components of the magnetic field in spherical coordinates:

Implementation of the analytical expression for the magnetic field ... (2)

This is my implementation:

function [B_r,B_theta] = magneticField_circularCoil(I,N,a,r,theta)

%MAGNETICFIELDCOMPONENTS Calculates the magnetic field components B_r and

%B_theta (spherical coordinates)

% B_r: B component in r direction

% B_theta: B component in theta direction

% I: current through conductor

% N: number of coil windings

% a: radius of the coil

% r: distance from the origin (spherical coordinates)

% theta: angle to z-axis (spherical coordinates) IN DEGREES

%

% Source for used analytic formula:

% https://ntrs.nasa.gov/api/citations/20140002333/downloads/20140002333.pdf

mu0 = 4.*pi.*1e-7;

alpha2 = a.^2 + r.^2 - 2.*a.*r.*sind(theta);

beta2 = a.^2 + r.^2 + 2.*a.*r.*sind(theta);

k2 = 1 - alpha2./beta2;

C = mu0 * I./pi;

[K_k2,E_k2] = ellipke(k2);

B_r = N.*(C.*a.^2.*cosd(theta))./(alpha2.*sqrt(beta2)) .* E_k2;

B_theta = N.*C./(2.*alpha2.*sqrt(beta2).*sind(theta)) .* ((r.^2+a.^2.*cosd(2.*theta)).*E_k2 - alpha2.*K_k2);

B_phi = 0;

To test the function, I wrote the following code:

%% Analytical calculation of the magnetic field of the Helmholtz coil arrangement %%

% Approximation: The coil diameter is neglected. All windings "in one

% place"

% approximation: The magnetic table top is assumed to act as a perfect

% magnetic "mirror" is assumed.

%

format compact;

% Radius of the Coil in meters:

a = 0.2;

% Current through Coil in amperes:

I = 5.0;

% Number of Coil windings:

N = 154; % source: datasheet Helmholtz coils

r_test = sqrt(0.2.^2+0.2.^2);

[B_r1,B_theta1] = magneticField_circularCoil(I,N,a,r_test,45.0)

[B_r2,B_theta2] = magneticField_circularCoil(I,N,a,r_test,135.0)

This leads to the following expected results (the magnitude of the resulting field is the same but it's in different directions):

>> Magnetfeld_Helmholtzspule_analytisch

B_r1 =

5.2273e-04

B_theta1 =

-4.2355e-06

B_r2 =

-5.2273e-04

B_theta2 =

-4.2355e-06

Is my implementation of the field components correct?

And how could I represent the superimposed field of two (or more) coils? I would appreciate any ideas!

2 Comments

Show NoneHide None

Alan Stevens on 2 Aug 2024 at 7:38

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/2142316-implementation-of-the-analytical-expression-for-the-magnetic-field-of-a-circular-current-loop-and-in#comment_3227231

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/2142316-implementation-of-the-analytical-expression-for-the-magnetic-field-of-a-circular-current-loop-and-in#comment_3227231

You define beta2 as a.^2 + r.^2 + 2.*a.*r, but the printed text has the 2ar term multiplied by sin(theta) in a similar manner to that for alpha2. (I've no idea if that will solve your problem though!).

Florian G on 2 Aug 2024 at 7:45

https://www.mathworks.com/matlabcentral/answers/2142316-implementation-of-the-analytical-expression-for-the-magnetic-field-of-a-circular-current-loop-and-in#comment_3227236

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/2142316-implementation-of-the-analytical-expression-for-the-magnetic-field-of-a-circular-current-loop-and-in#comment_3227236

Thanks, I updated the code accordingly!

Sign in to comment.

Sign in to answer this question.

Answers (1)

Alan Stevens on 2 Aug 2024 at 8:48

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/2142316-implementation-of-the-analytical-expression-for-the-magnetic-field-of-a-circular-current-loop-and-in#answer_1493806

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/2142316-implementation-of-the-analytical-expression-for-the-magnetic-field-of-a-circular-current-loop-and-in#answer_1493806

Open in MATLAB Online

When I run it I get different signs as well as slightly different magnitudes:

%% Analytical calculation of the magnetic field of the Helmholtz coil arrangement %%

% Approximation: The coil diameter is neglected. All windings "in one

% place"

% approximation: The magnetic table top is assumed to act as a perfect

% magnetic "mirror" is assumed.

%

format compact;

% Radius of the Coil in meters:

a = 0.2;

% Current through Coil in amperes:

I = 5.0;

% Number of Coil windings:

N = 154; % source: datasheet Helmholtz coils

r_test = sqrt(0.2.^2+0.2.^2);

[B_r1,B_theta1] = magneticField_circularCoil(I,N,a,r_test,45.0)

B_r1 = 5.7391e-04

B_theta1 = 4.8589e-05

[B_r2,B_theta2] = magneticField_circularCoil(I,N,a,r_test,135.0)

B_r2 = -5.7391e-04

B_theta2 = 4.8589e-05

function [B_r,B_theta] = magneticField_circularCoil(I,N,a,r,theta)

%MAGNETICFIELDCOMPONENTS Calculates the magnetic field components B_r and

%B_theta (spherical coordinates)

% B_r: B component in r direction

% B_theta: B component in theta direction

% I: current through conductor

% N: number of coil windings

% a: radius of the coil

% r: distance from the origin (spherical coordinates)

% theta: angle to z-axis (spherical coordinates) IN DEGREES

%

% Source for used analytic formula:

% https://ntrs.nasa.gov/api/citations/20140002333/downloads/20140002333.pdf

mu0 = 4.*pi.*1e-7;

alpha2 = a.^2 + r.^2 - 2.*a.*r.*sind(theta);

beta2 = a.^2 + r.^2 + 2.*a.*r.*sind(theta);

k2 = 1 - alpha2./beta2;

C = mu0 * I./pi;

[K_k2,E_k2] = ellipke(k2);

B_r = N.*(C.*a.^2.*cosd(theta))./(alpha2.*sqrt(beta2)) .* E_k2;

B_theta = N.*C./(2.*alpha2.*sqrt(beta2).*sind(theta)) .* ((r.^2+a.^2.*cosd(2.*theta)).*E_k2 - alpha2.*K_k2);

B_phi = 0;

end

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Sign in to answer this question.

See Also

Tags

  • electromagnetism
  • magnetic field
  • coil

Products

  • MATLAB

Release

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.


Implementation of the analytical expression for the magnetic field ... (6)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

Implementation of the analytical expression for the magnetic field ... (2024)

FAQs

What is the expression for the magnetic field? ›

The magnetic field strength at the center of a circular loop is given by B=μ0I2R(at center of loop), B = μ 0 I 2 R (at center of loop) , where R is the radius of the loop. RHR-2 gives the direction of the field about the loop.

What is the equation for the magnetic field? ›

The magnetic field equation for a wire or the magnitude of magnetic field equation is: B = μ 0 ∗ I 2 ∗ Π ∗ r . The magnetic field B and the movement of electric charges v create a magnetic force where the magnetic force formula is F → = q ∗ v → × B → .

What is the general formula for the magnetic field? ›

B = μ 0 I 2 π r

In the equation, µ0 is a special constant known as the permeability of free space(µ0=4π×10-7 T⋅ m/A). Materials with higher permeability possess the ability to concentrate on magnetic fields. The magnetic field has direction as it is a vector quantity.

What is the expression for the magnetic field that induces the electric field? ›

The induced electric field formula is E = -dΦB/dt. "E" represents the induced electric field, "dΦB" signifies the change in magnetic flux, and "dt" denotes the change in time.

What is the exact equation for the magnetic field? ›

The magnitude of the magnetic field field a radial distance r away from a long, straight wire is B = μ0I/(2πr). Details of the calculation: B = (4π*10-7 N/A2)*30 A/(2π*0.01 m) = 1.2*10-5/*0.02 = N/(Am) = 6*10-4 T.

What is the mathematical expression for magnetic field strength? ›

r is the distance from the centre of the coil. B=μ×H, where B is the magnetic field strength, μ is the magnetic permeability of the material, and H is the magnetic field intensity.

What is the current equation for the magnetic field? ›

The strength of a magnetic field, 𝐵 , some distance 𝑑 away from a straight wire carrying a current, 𝐼 , can be found using the equation 𝐵 = 𝜇 𝐼 2 𝜋 𝑑 ,  where 𝜇  is a constant known as “the permeability of free space” and has the value 𝜇 = 4 𝜋 × 1 0 ⋅ /    T m A .

What is the formula for EMF of a magnetic field? ›

The equation for the emf induced by a change in magnetic flux is emf=−NΔΦΔt. This relationship is known as Faraday's law of induction. The units for emf are volts, as is usual. The minus sign in Faraday's law of induction is very important.

What is the formula of magnetic field examples? ›

Key Equations
Permeability of free spaceμ0=4π×10−7T⋅m/A
Magnetic field of a current loopB=μ0I2R (at center of loop)
Ampère's law∮→B⋅d→l=μ0I
Magnetic field strength inside a solenoidB=μ0nI
Magnetic field strength inside a toroidB=μoNI2πr
6 more rows
Jul 9, 2024

What is the functional formula of the magnetic field? ›

The dot product m · B = mBcos(θ), where m and B represent the magnitude of the m and B vectors and θ is the angle between them. If m is in the same direction as B then the dot product is positive and the gradient points "uphill" pulling the magnet into regions of higher B-field (more strictly larger m · B).

What is the rule for magnetic field? ›

The right hand rule states that: to determine the direction of the magnetic force on a positive moving charge, point your right thumb in the direction of the velocity (v), your index finger in the direction of the magnetic field (B), and your middle finger will point in the direction of the the resulting magnetic force ...

Which equation is used to calculate the magnetic? ›

You can calculate the magnitude of a magnetic force acting on a moving charge using the equation F = qvB*sin(θ), where Q is the charge, V is its velocity, B is the magnetic field, and θ is the angle between the velocity and magnetic field vectors.

What is the equation for the electric magnetic field? ›

1.1 Maxwell's Equations

E = ~E(x,y,z,t) − electric field, ~B = ~B(x,y,z,t) − magnetic flux density. The electric field ~E and the magnetic flux density ~B are regarded as fundamental in that they give the force on a charge q moving with a velocity~v. This force is called the Lorentz force.

What is an expression for the force of the magnetic field? ›

We can thus use the equation F=qvBsinθ F = q v B sin θ to find the force. Solution. The magnetic force is. F=qvbsinθ.

How do you induce a magnetic field? ›

An easy way to create a magnetic field of changing intensity is to move a permanent magnet next to a wire or coil of wire. Remember: The magnetic field must increase or decrease in intensity perpendicular to the wire (so that the lines of flux “cut across” the conductor), or else no voltage will be induced.

What is the magnetic field force expression? ›

We are given the charge, its velocity, and the magnetic field strength and direction. We can thus use the equation F=qvBsinθ F = q v B sin θ to find the force. F=qvbsinθ.

What is the expression for Earth's magnetic field? ›

Formula for Earth's Magnetic Field

The magnetic intensity of the earth's magnetic field forms an angle with the horizontal axis known as the Angle of Dip (δ). The strength of the Earth's magnetic field may be divided into two components: tan A = BV/BH, sin A = BV/B, and.

What is the expression for the magnetic moment? ›

Magnetic Moment unit

So, these two units are equivalent to each other and can be represented as 1 Ampere-meter square (A-m²) = 1 Joule per Tesla (J/T) or 1 J T-1. The dimensional formula for a magnetic moment is given by M0L2T0A-1.

References

Top Articles
Latest Posts
Recommended Articles
Article information

Author: Lilliana Bartoletti

Last Updated:

Views: 5968

Rating: 4.2 / 5 (73 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Lilliana Bartoletti

Birthday: 1999-11-18

Address: 58866 Tricia Spurs, North Melvinberg, HI 91346-3774

Phone: +50616620367928

Job: Real-Estate Liaison

Hobby: Graffiti, Astronomy, Handball, Magic, Origami, Fashion, Foreign language learning

Introduction: My name is Lilliana Bartoletti, I am a adventurous, pleasant, shiny, beautiful, handsome, zealous, tasty person who loves writing and wants to share my knowledge and understanding with you.