I want to find magnetic field generated by infinitly long wire using ampere's law but ampere's law is gives us scaler how can i get vectorial solutions
ampere's law : u0*i/(2*pi*d)

 Accepted Answer

Star Strider
Star Strider on 23 Apr 2017
You may not have the definition of it that you need.
Try this:
mu0 = pi*4E-7; % Ref: https://en.wikipedia.org/wiki/Vacuum_permeability
AmpereB = @(m0u,I,r) (mu0.*I)./(2*pi*r); % µₒ = Magnetic Constant, I = Current (A), r = radius (m), Ref: https://en.wikipedia.org/wiki/Amp%C3%A8re%27s_circuital_law
radius = linspace(1E-3, 1);
I = 1;
figure(1)
semilogy(radius, AmpereB(mu0,I,radius))
grid
xlabel('r (m)')
ylabel('B')

4 Comments

Sogogo
Sogogo on 23 Apr 2017
thanks for your answer
but how can i get magnetic field vectors (arrows) arround the wire, how can i get directional arrows
These appear to have the correct directions (using conventional calculus to generate directional components for the quiver arrows):
mu0 = pi*4E-7; % Ref: https://en.wikipedia.org/wiki/Vacuum_permeability
AmpereB = @(m0u,I,r) (mu0.*I)./(2*pi*r); % µₒ = Magnetic Constant, I = Current (A), r = radius (m), Ref: https://en.wikipedia.org/wiki/Amp%C3%A8re%27s_circuital_law
radius = linspace(1E-3, 1);
I = 1;
figure(1)
semilogy(radius, AmpereB(mu0,I,radius))
grid
xlabel('r (m)')
ylabel('B')
thp = linspace(0, 2*pi);
thq = linspace(0, 2*pi, 10);
r5f = @(th) AmpereB(mu0,I,0.5)*[cos(th); sin(th)]; % Circle For Quiver Origins
uv = AmpereB(mu0,I,0.5)*[-sin(thq); cos(thq)]; % Quiver Directions
r5q = r5f(thq); % Quiver Origins
r5c = r5f(thp); % Continuous Circle
figure(2)
quiver(r5q(1,:), r5q(2,:), uv(1,:), uv(2,:)) % Plot Arrows
hold on
plot(r5c(1,:), r5c(2,:), '-r') % Plot Radius=0.5 Circle
hold off
grid
axis equal
title('B(r=0.5m, I=1A)')
This is the best I can do. I’ve not done anything with Ampere’s law since shortly before Pangaea split apart.
Sogogo
Sogogo on 23 Apr 2017
thank you very much i should keep working from this one
Star Strider
Star Strider on 23 Apr 2017
As always, my pleasure!

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Asked:

on 23 Apr 2017

Commented:

on 23 Apr 2017

Community Treasure Hunt

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

Start Hunting!