Advertisement
hiddenGem

Laser Beam

Jul 25th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.61 KB | None | 0 0
  1. %% Laser Beam
  2. % Determines the angle of refraction of a laser beam and the time it takes
  3.  
  4. % Constants
  5. c = 3*10^8;                     % [m/s] Speed of Light
  6.  
  7. % Inputs and Variables
  8. d = input('Thickness of the glass\n');
  9. theta = input('Angle of incidence in degrees\n')*pi/180;
  10. n = input('Index of refraction\n');
  11.  
  12. % Outputs and Equations
  13. theta2 = asin(sin(theta)/n);
  14. t = d*n/(c*cos(theta2));
  15. fprintf('Angle of refraction: %.3f rad\ntime it takes: %.3e s',theta2,t)
  16.  
  17. %{
  18. This program uses snell's law (n1sin(theta1) = n2sin(theta2)) to calculate
  19. the unknown and n1 = 1 which is the index of refraction in air
  20. %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement