Advertisement
hiddenGem

Energy in a Solenoid

Jul 8th, 2020
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.43 KB | None | 0 0
  1. %% Energy in a Solenoid
  2. % Determines the energy stored in a solenoid
  3.  
  4. % Constants
  5. muNaught = (4*pi)*10^-7;                   %[T*m/A] Vacuum Permeability
  6.  
  7. % Inputs and Variables
  8. N = input('How many turns\n');
  9. r = input('The radius\n');
  10. l = input('The length\n');
  11. I = input('The current of the system\n');
  12.  
  13. % Outputs and Equations
  14. A = pi*r*r;
  15. L = muNaught*A*N*N/l;
  16. Energy = 0.5*L*I^2;
  17. fprintf('The energy stored is %e J', Energy)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement