hiddenGem

Function: B-field of a Wire

Jun 25th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.31 KB | None | 0 0
  1. %% B-field of a Wire
  2. % Calculates the magnitude, x-component, and y-component of a B-field from
  3. % a wire carrying an electrical current. There is a script file under a similar
  4. % on my page
  5. function [mag, Bx, By] = wireBfield(I, x, y)
  6. mu0 = (4*pi)*10^-7;        %[T*m/A] Vacuum Permeability
  7. r = sqrt(x^2+y^2);
  8. mag = mu0*I/(2*pi*r);
  9. Bx = y*mag/r;
  10. By = x*mag/r;
  11. end
Add Comment
Please, Sign In to add comment