How to draw multiple rectangular diffraction pattern
显示 更早的评论
I have a single rectangular diffraction pattern, and I want to draw 8*8 rectangular diffraction pattern.
I am relatively new at using matlab so any help would be much appreciated.
This is my single rectangular diffraction code:
clc
clear all
lambda=632e-9; k=(2*pi)/lambda;
a=1e-3; b=4e-3; d=20e-3;
Io = 100.0;
R = 1;
Y = (-0.4e-2:1e-5:0.4e-2); Z=Y ;
beta = k*b*Y/(2*R*pi);
alpha = k*a*Z/(2*R*pi);
for i=1:length(Y)
for j=1:length(Z)
I(i,j)=Io.*((sinc(alpha(j)).^2).*(sinc(beta(i))).^2);
end
end
figure(1)
imshow(I)
title('Fraunhofer Diffraction','fontsize',14)
fh = figure(1);
set(fh, 'color', 'white');
采纳的回答
更多回答(1 个)
Stijn Haenen
2019-12-8
Somthing like this?
clc
clear all
lambda=632e-9; k=(2*pi)/lambda;
a=1e-3; b=4e-3; d=20e-3;
Io = 100.0;
R = 1;
Y = (-0.4e-2:1e-5:0.4e-2); Z=Y ;
beta = k*b*Y/(2*R*pi);
alpha = k*a*Z/(2*R*pi);
ypos_rectangle=(-0.7e-2:2e-3:0.7e-2);
zpos_rectangle=(-0.7e-2:2e-3:0.7e-2);
for i=1:length(Y)
for j=1:length(Z)
Phase=0;
for r_y=1:8
for r_z=1:8
Phase=Phase+((sinc(alpha(j)-ypos_rectangle(r_y))).*(sinc(beta(i)-zpos_rectangle(r_z))));
end
end
I(i,j)=Io.*Phase^2;
end
end
figure(1)
imshow(I)
title('Fraunhofer Diffraction','fontsize',14)
fh = figure(1);
set(fh, 'color', 'white');
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


