Advertisement
hiddenGem

Spaceship Equipped With a Proton Cannon

Aug 6th, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.42 KB | None | 0 0
  1. %% Spaceship Equipped With a Proton Cannon
  2. % Determines the velocity of protons in a resting frame of a movie and in
  3. % the backward direction
  4.  
  5. % Inputs and Variables
  6. U = input('Ship speed\n');
  7. Uprime = input('Proton cannon speed\n');
  8.  
  9. % Outputs and Equations
  10. BetaForward = (U+Uprime)/(1+U*Uprime);
  11. BetaBackward = (U-Uprime)/(1+U*-Uprime);
  12. fprintf('Velocity forward: %.4f\nVelocity backward: %.4f\n',BetaForward,BetaBackward)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement