A list,

This paper uses GUI to demonstrate Young’s double slit interference experiment, parameters can be adjusted, the experimental principle refer to the optical tutorial.

Ii. Source code

Lambda =str2num(get(handles. Edit1,'string')) *1e-9; D =str2num(get(handles. Edit2,'string')) *1e-3; D=str2num(get(handles. Edit3,'string')); Xa =str2num(get(handles. Edit4,'string')); Xb =str2num(get(handles. Edit5,'string')); N1 =str2num(get(handles. Edit6,'string')); Y =str2num(get(handles. Edit7,'string')); Yb =str2num(get(handles. Edit8,'string')); % n =str2num(get(handles. Edit9,'string')); % Number of equal shares in y direction k=2*pi/lambda; % Calculate wave number x=linspace(xa,xb,n1); % x coordinate y = linspace (ya and yb, n2); % y coordinates (x, y) = meshgrid (x, y); r1=sqrt((x-d/2). ^2+y.^2+D^2);

r2=sqrt((x+d/2). ^2+y.^2+D^2);

I=(cos(k*r1)./r1+cos(k*r2)./r2).^2+ (sin(k*r1)./r1+sin(k*r2)./r2).^2;

I=I/(max(max(I))); 

I=I*255;

 

axes(handles.axes1)

x=linspace(xa,xb,n1);

y=linspace(ya,yb,n2);

image(x,y,I)

colormap(gray(255))

xlabel('x (m)')

ylabel('y (m)')

title('Young's two-hole interference fringe'Lambda =str2num(get(handles. Edit1,'string')) *1e-9; D =str2num(get(handles. Edit2,'string')) *1e-3; D=str2num(get(handles. Edit3,'string')); Xa =str2num(get(handles. Edit4,'string')); Xb =str2num(get(handles. Edit5,'string')); N1 =str2num(get(handles. Edit6,'string')); Y =str2num(get(handles. Edit7,'string')); Yb =str2num(get(handles. Edit8,'string')); % n =str2num(get(handles. Edit9,'string')); % Number of equal shares in y direction k=2*pi/lambda; % Calculate wave number x=linspace(xa,xb,n1); % x coordinate y = linspace (ya and yb, n2); % y coordinates (x, y) = meshgrid (x, y); r1=sqrt((x-d/2). ^2+y.^2+D^2);

r2=sqrt((x+d/2). ^2+y.^2+D^2);

I=(cos(k*r1)./r1+cos(k*r2)./r2).^2+ (sin(k*r1)./r1+sin(k*r2)./r2).^2;

I=I/(max(max(I)));

 

axes(handles.axes1)

x=linspace(xa,xb,n1);

y=linspace(ya,yb,n2); 

 

mesh(x,y,I) 

colormap(hot) 

xlabel('x (m)') 

ylabel('y (m)') 

zlabel('intensity') 

title('Intensity distribution') 
 
Copy the code

3. Operation results



Fourth, note

Version: 2014 a