Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% Three Circular Loops
- % Calculates the magnetic field in three scenarios with a line and a
- % circular loop: They are in the same direction, the opposite direction,a
- % and they are perpendicular to each other
- % Constants
- muNaught = 4*pi*10^-7; %[T*m/A] Vacuum Permeability
- % Inputs and Variables
- I = input('What is the current?\n');
- r = input('What is the radius of the circle?\n');
- % Output and Equations
- Bline = muNaught*I/(2*pi*r);
- Bcircle = pi*Bline;
- B = [Bline+Bcircle; abs(Bline-Bcircle); sqrt(Bline^2+Bcircle^2)];
- fprintf(['The magnitudes for the circle and loop in the same direction,\n'...
- 'opposite direction, and perpendicular are:\n'...
- '%.4e T, %.4e T, and %.4e T\n'], B(1), B(2), B(3))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement