Advertisement
hiddenGem

Spaceship at Relativistic Speed

Aug 6th, 2020 (edited)
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.51 KB | None | 0 0
  1. %% Spaceship at Relativistic Speed
  2. % Determines the speed of the spacefhip in terms of the speed of light and
  3. % how much time it takes to cook something in the oven
  4.  
  5. % Constants
  6. c = 3.00*10^8;                  % [m/s] Speed of Light
  7.  
  8. % Inputs and Variables
  9. L0 = input('Spaceship length at rest\n');
  10. L = input('Spaceship length when moving\n');
  11. t = input('Time for oven\n');
  12.  
  13. % Outputs and Equations
  14. Beta = sqrt(1-(L/L0)^2);
  15. T = t/sqrt(1-Beta^2);
  16. fprintf('Speed of the spaceship: %.3f\nTime: %.3f Hours', Beta, T)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement