|
|
【答案】应助回帖
★ ★ ★ ★ ★ 感谢参与,应助指数 +1 glddoyss: 金币+5, ★有帮助, 虽然没指出我的错误,不过提供的程序也有用啦 2012-04-04 15:24:08
利用光波衍射的菲涅尔近似-菲涅尔衍射公式来计算双缝的衍射:
![]()
下面的这个程序你明白了的话,你这个问题就解决了,其他物体的衍射模拟你也就会了。
(1)实验参数设定:
Lamda=0.6328; % um, Wavelength of the input light
DDist=200.0e+3; % um, Diffraction distance to the output plane
M=512; N=512; % Number of the sample array
dx=10.0; dy=10.0; % um, Sampling space
SWidth=4; % pixels, Width of the Slits
SDist=30; % pixels, Distance between two slits
(2)建立衍射屏函数(Slit)的抽样点阵
DScreen=zeros(M,N); % define a M*N matrix with zero elements;
DScreen(:,(N-SDist-SWidth)/2 N-SDist+SWidth)/2)=1.0; % Slit one
DScreen(:,(N+SDist-SWidth)/2 N+SDist+SWidth)/2)=1.0; % Slit two
%也可用下列语句调入实现设计好的衍射屏图样(bmp格式512×512)。
DScreen=double(imread('DScreen1.bmp'));
(3)衍射屏函数的图形显示:
figure(1); % 激活1号显示窗口为当前窗口
colormap(gray); %设置灰度图形显示格式
imshow(Slit); %在当前图形窗口显示衍射屏函数
(4)建立高斯球面波函数 的抽样点阵:
% Set coordinate of the sample array
[x,y]=meshgrid(-M*dx/2:dx M-1)*dx/2,-N*dy/2:dy N-1)*dy/2);
SphFunct=exp(i*pi*(x.^2+y.^2)/(Lamda*DDist)); % The spherical wave function
(5) 通过计算菲涅尔衍射积分求衍射光场:
% Simulate the Fresnel diffraction
DScreen_F=fftshift(fft2(fftshift(DScreen))); %Fourier transform of the slit function.
SphFunct_F=fftshift(fft2(fftshift(SphFunct))); %Fourier transform of the spherical function.
FrDiffract=fftshift(ifft2(fftshift(DScreen_F.*SphFunct_F))); % Inverse Fourier transform
(6)显示输出平面上的光强度分布:
% Display the diffraction pattern
FrDiffract_I=FrDiffract.*conj(FrDiffract); % Intensity distribution
FrDiffract_I=FrDiffract_I/max(max(FrDiffract_I));
imshow(FrDiffract_I/max(max(FrDiffract_I)));
(7)保存衍射图样 |
|