Advertisement
hiddenGem

Diameter of a Cyclotron

Jun 24th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.66 KB | None | 0 0
  1. %% Diameter of a Cyclotron
  2. % Determines the diameter of ions in a cyclotron and how many times the
  3. % ions complete their orbit in a given amount of time.
  4.  
  5. % Constants
  6. elemCharge = 1.6*10^-19;             %[C] Elementary Charge
  7.  
  8. % Inputs and Variables
  9. q = input('Are the ions singly, doubly, or triply charged?\n')*elemCharge;
  10. B = input('What is the magnetic field?\n');
  11. mass = input('What is the mass of the ions in kg?\n');
  12. v = input('What is the speed\n');
  13. t = input('How many seconds?\n');
  14.  
  15. % Ouputs and Equations
  16. r = mass*v/(q*B);
  17. d = 2*r;
  18. c = pi*d;
  19. orbits = v*t/c;
  20. fprintf('The diameter is %.3f m and the ions make %.4e revolutions', d, orbits);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement