Advertisement
hiddenGem

Flux of a Solenoid

Jul 1st, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.55 KB | None | 0 0
  1. %% Flux of a Solenoid
  2. % Determines the total magnetic flux through the curved surface of the
  3. %   cylinder
  4.  
  5. % Constants
  6. muNaught = (4*pi)*10^-7 ;                %[T*m/A] Vacuum Permeability
  7.  
  8. % Inputs and Variables
  9. N = input('How many turns does the wire make?\n');
  10. d = input('What is the diameter of the solenoid?\n');
  11. l = input('What is the length of the solenoid?\n');
  12. i = input('What is the current the wire is carrying?\n');
  13.  
  14. % Outputs and Equations
  15. n = N/l;
  16. r = d/2;
  17. Flux = muNaught*n*i*pi*r^2;
  18. fprintf('The magnetic flux is %.4e Wb', Flux);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement