Advertisement
hiddenGem

Transparent Material

Jul 26th, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.26 KB | None | 0 0
  1. %% Transparent Material
  2. % Determines the index of refraction of a material, angle of reflected ray,
  3. % angles of refracted rays
  4.  
  5. % Inputs and Variables
  6. thetac = input('Thetac\n');
  7. theta1 = input('Striking the material angle for reflected\n');
  8.  
  9. % Outputs and Equations
  10. n = 1/sind(thetac);
  11. theta2 = asind(sind(theta1)/n);
  12. theta3 = asind(n*sind(theta1));
  13. fprintf(['The index of refraction is: %.3f\n'...
  14.          'The reflected ray is: %.2f deg\n'...
  15.          'The refracted ray is: %.2f deg\n'...
  16.          'The leaving ray is: %.2f deg\n'],n,theta1,theta2,theta3)
  17.  
  18. %{
  19. Yeah so it would take too much space to ask for the specifics of the
  20. problem in the command window so they are going here
  21.  
  22. The first input is
  23. "The refractive index of a transparent material can be determined by
  24. measuring the critical angle when the solid is in air" and asks for that
  25. angle
  26.  
  27. The second input is
  28. "A light ray strikes this material (from air) at an angle of 'theta' with
  29. respect to the normal of the surface"
  30.  
  31.  
  32. The outputs are going to be weird so heres the meaning list
  33.  
  34. First output
  35. Index of refraction of the material
  36.  
  37. Second Output
  38. Angle of the reflected ray
  39.  
  40. Third Output
  41. Angle of refracted ray
  42.  
  43. Four Output
  44. Angle of refracted ray when exiting the material
  45. %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement