杨氏干涉的MATLAB仿真
本文将介绍如何在MATLAB中进行杨氏干涉的仿真。杨氏干涉是一种光学干涉实验,利用两束于接近平行的单色光共同照射同一物体,通过观察光强分布图案来研究光的波动性质。以下是MATLAB代码实现。
%% Parameters
wavelength = 632.8e-9; % wavelength of laser (m)
distance = 50e-3; % distance from the slit to the screen (m)
slit_width = 10e-6; % slit width (m)
slit_separation = 20e-6; % separation between slits (m)
screen_size = 0.1; % size of the screen (m)
num_pixels = 500; % number of pixels in each dimension
pixel_size = screen_size/num_pixels; % size of each pixel on the screen (m)
%% Initialization
x = linspace(-screen_size/2, screen_size/2, num_pixels); % x coordinates of screen pixels
y = linspace(-screen_size/2, screen_size/2, num_pixels); % y coordinates of screen pixels
[X,Y] = meshgrid(x