Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- n=45 # Value of the refractive index
- d=0.02 #Slit separation value
- L=500e-6 #The Wavelength value
- theta_i=np.linspace(0,100,10)*np.pi/180 # the incident angle
- print(theta_i) #printing theta_i values
- theta_n=np.arcsin(n*L/d-np.sin(theta_i)) # the diffraction angle
- s=theta_n*180/np.pi # diffraction angle is converted to degrees
- plt.xlim(10,90) #setting the x axis limits (scale)
- plt.ylim(0,80) #setting the y axis limits (scale)
- plt.plot(theta_i*180/np.pi,s) # x axis is converted to degrees then plotting x and y axis
- plt.xlabel("theta_i") #x axis labeling
- plt.ylabel("theta_n") #y axis labeling
- plt.title("Diffraction angle as a function of incident angle") #Title labeling
- plt.show() #this command was written to show the graph
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement