一、简介
基于matlab 仿真圆孔的菲涅尔衍射
二、源代码
%圆孔衍射 菲涅尔
clear
lamda=633*10^(-6);
k=2*pi/lamda;%?¨??
p=1;
z=100;
fu=sqrt(-1);
d=0.1;
[X,Y]=meshgrid(-p:0.005:p,-p:0.005:p);
for i=1:size(X,1)
for j=1:size(Y,1)
if X(i,j).^2+Y(i,j).^2<=(d/2)^2
A(i,j)=1;
else
A(i,j)=0;
end
end
end
for i=1:size(X,1)
for j=1:size(Y,1)
A1(i,j)=A(i,j)*exp(fu*k/(2*z)*(X(i,j).^2+Y(i,j).^2));
end
end
figure(1)
subplot(2,2,1);
imshow(A,[])
%A1=A*exp(j*k/(2*z)*)
afft=fft2(A1);
aabs=abs(afft);
aabss1=fftshift(aabs);
aabss2=aabss1.*exp(fu*k*z)/(fu*lamda*z);
aabss=abs(aabss2);
subplot(2,2,2);
imshow(aabss,[])
colormap(gray);
subplot(2,2,3);
[i,j]=size(aabss);
C=(i+1)/2;
B=aabss(C,:);
x=-p:0.005:p;
plot(x,B)
三、运行结果
四、备注
版本:2014a