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

18 views (last 30 days)

Show older comments

Florian G on 2 Aug 2024 at 6:53

  • Link

    Direct link to this question

    https://ch.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://ch.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://ch.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://ch.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

Direct link to this comment

https://ch.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://ch.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://ch.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://ch.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)

References

Top Articles
Trident Scholar Abstracts 2005
Control Tutorials for MATLAB and Simulink
Funny Roblox Id Codes 2023
Www.mytotalrewards/Rtx
San Angelo, Texas: eine Oase für Kunstliebhaber
Golden Abyss - Chapter 5 - Lunar_Angel
Www.paystubportal.com/7-11 Login
Steamy Afternoon With Handsome Fernando
fltimes.com | Finger Lakes Times
Detroit Lions 50 50
18443168434
Newgate Honda
Zürich Stadion Letzigrund detailed interactive seating plan with seat & row numbers | Sitzplan Saalplan with Sitzplatz & Reihen Nummerierung
978-0137606801
Nwi Arrests Lake County
Missed Connections Dayton Ohio
Justified Official Series Trailer
London Ups Store
Committees Of Correspondence | Encyclopedia.com
Jinx Chapter 24: Release Date, Spoilers & Where To Read - OtakuKart
How Much You Should Be Tipping For Beauty Services - American Beauty Institute
How to Create Your Very Own Crossword Puzzle
Apply for a credit card
Unforeseen Drama: The Tower of Terror’s Mysterious Closure at Walt Disney World
Ups Print Store Near Me
How Taraswrld Leaks Exposed the Dark Side of TikTok Fame
University Of Michigan Paging System
Random Bibleizer
10 Best Places to Go and Things to Know for a Trip to the Hickory M...
Receptionist Position Near Me
Black Lion Backpack And Glider Voucher
Gopher Carts Pensacola Beach
Duke University Transcript Request
Nikki Catsouras: The Tragic Story Behind The Face And Body Images
Kiddie Jungle Parma
Lincoln Financial Field, section 110, row 4, home of Philadelphia Eagles, Temple Owls, page 1
The Latest: Trump addresses apparent assassination attempt on X
In Branch Chase Atm Near Me
Appleton Post Crescent Today's Obituaries
Craigslist Red Wing Mn
American Bully Xxl Black Panther
Ktbs Payroll Login
Jail View Sumter
Thotsbook Com
Funkin' on the Heights
Caesars Rewards Loyalty Program Review [Previously Total Rewards]
Marcel Boom X
Www Pig11 Net
Ty Glass Sentenced
Game Akin To Bingo Nyt
Ranking 134 college football teams after Week 1, from Georgia to Temple
Latest Posts
Article information

Author: Mrs. Angelic Larkin

Last Updated:

Views: 5504

Rating: 4.7 / 5 (67 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Mrs. Angelic Larkin

Birthday: 1992-06-28

Address: Apt. 413 8275 Mueller Overpass, South Magnolia, IA 99527-6023

Phone: +6824704719725

Job: District Real-Estate Facilitator

Hobby: Letterboxing, Vacation, Poi, Homebrewing, Mountain biking, Slacklining, Cabaret

Introduction: My name is Mrs. Angelic Larkin, I am a cute, charming, funny, determined, inexpensive, joyous, cheerful person who loves writing and wants to share my knowledge and understanding with you.