Advertisement
hiddenGem

Light in Plastic

Jul 25th, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.47 KB | None | 0 0
  1. %% Light in Plastic
  2. % Determines the speed of light inside plastic
  3.  
  4. % Constants
  5. c = 3*10^8;                      % [m/s] speed of light
  6.  
  7. % Inputs and Variables
  8. theta1 = input('Angle of incidence in degrees\n')*pi/180;
  9. theta2 = input('Angle of refraction in degrees\n')*pi/180;
  10.  
  11. % Outputs and Equations
  12. n = sin(theta1)/sin(theta2);
  13. c2 = c/n;
  14. fprintf('The speed of light in plastic is: %.4e m/s',c2)
  15. %{
  16. The angles for thetas are asked in degrees but stored in radians
  17. %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement