Giao thoa sóng từ hai nguồn điểm

Kết quả mô phỏng giao thoa với bước sóng \(\lambda=550\) nm.
Hình ảnh giao thoa biểu diễn qua đường đồng mức

Code chương trình Matlab

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
function interf_2_poin_sources
% Author: Tran Hai Cat
% Lecturer in Physics, HCM University of Technology and Education
% - Dai hoc Su pham Ky thuat Tp. Ho Chi Minh
% Created: 2019.08.13
clc
clear variables
close all

%% CONST
c = 3e8; % speed of light [m/s]

%% PARAMETERS
wave_length = 550; % nm

% Source coordinates:
xs1 = 0;
ys1 = 1.5e-6;
xs2 = 0;
ys2 = -1.5e-6;

% Enter dimensions:
Nx = 1000; % Number of X-grids
Ny = 500; % Number of Y-grids

pattern_type = 0; % 0 - pcolor, 1 - contourf
xmin = -10e-6; xmax = 10e-6; ymin = -5e-6; ymax = 5e-6;
%% CALCULATION:
lambda = wave_length*1e-9;
T = lambda/c;
w = 2*pi/T;
k = 2*pi/lambda;

x = linspace(xmin,xmax,Nx);
y = linspace(ymin,ymax,Ny);
x_plot = x*1e6;
y_plot = y*1e6;

t = 0;
dt = T/20;

% Create figure frame:
fig = figure('name','CALCULATION PROCESS',...
'color','w','numbertitle','off');
set(gcf,'Units','normalized');
set(gcf,'Position',[0 0 1 0.9]);
axis equal
colormap jet

Imax = 0;
E = zeros(Nx,Ny);
N_draw = 30;
frame = 0;
for i_draw = 1:N_draw
t = t+dt;

for i = 1:Nx
for j = 1:Ny
r1 = sqrt((x(i)-xs1)^2+(y(j)-ys1)^2);
r2 = sqrt((x(i)-xs2)^2+(y(j)-ys2)^2);
if (r1>lambda/4)&&(r2>lambda/4)
E(i,j) = exp(1i*(w*t-k*r1))/sqrt(r1)...
+exp(1i*(w*t-k*r2))/sqrt(r2);
end
end
end
I = real(E');

if i_draw<=10
I_abs = abs(I);
Imax_new = max(I_abs(:));
if Imax<Imax_new
Imax = Imax_new;
end
else
figure(fig)
if pattern_type==1
contourf(x_plot,y_plot,I)
else
pcolor(x_plot,y_plot,I)
end
axis image
shading interp;
title(['Wave length \lambda = ',num2str(wave_length),'nm']);
xlabel('x [{\mu}m]','fontsize',14);
ylabel('y [{\mu}m]','fontsize',14);
colorbar('vertical');
caxis(gca,[-Imax Imax]);
set(gca,'fontsize',14);
drawnow
frame = frame+1;
M(frame)=getframe(gcf);
end
end
fig = figure('name','Two Point Source Interference',...
'color','w','numbertitle','off');
set(gcf,'Units','normalized');
set(gcf,'Position',[0 0 1 0.9]);

movie(fig,M,40)