Advertisement
hiddenGem

Square Loop

Jun 25th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.73 KB | None | 0 0
  1. %% Square Loop
  2. % Determines the size of the magnetic field at the center and at one of the
  3. %    corners of the square
  4.  
  5. % Constants
  6. muNaught = (4*pi)*10^-7 ;                %[T*m/A] Vacuum Permeability
  7. arb = sqrt(2)*muNaught/pi
  8.  
  9. % Inputs and Variables
  10. a = input('What is the length of the side?\n');
  11. I = input('What is the current of the loop\n');
  12. % Outputs and Equations
  13. Bcorn = arb*I/(4*a);
  14. Bcent = Bcorn*8;
  15. fprintf(['The magnitude at the center of the square and at one of the corners are:\n'...
  16.         '%4e T and %.4e T\n'], Bcent, Bcorn)
  17.  
  18. %{
  19. The variable 'arb' in the constants section is just a placeholder. It is
  20.     not an actual constant. It just makes the line in the outputs and equations
  21.     section less crowded
  22. %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement