Advertisement
hiddenGem

Punch and Judy

Aug 6th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.33 KB | None | 0 0
  1. %% Punch and Judy
  2. % Determines the speed of a rocket seen on earth
  3.  
  4. % Constants
  5. c = 3.00*10^8;                  % [m/s] Speed of Light
  6.  
  7. % Inputs and Variables
  8. Vp = input('Speed punch sees\n');
  9. Vj = input('Judy''s speed\n');
  10.  
  11. % Outputs and Equations
  12. v = (Vp-Vj)/(1-Vp*Vj);
  13. fprintf('Speed of the rocket seen by judy: %.3f\n',v)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement