How to draw multiple rectangular diffraction pattern

21 次查看(过去 30 天)
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');

采纳的回答

Image Analyst
Image Analyst 2019-12-8
Simply use repmat(I, [8, 8]) to replicate your image 8 times in every direction.
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
% Replicate in an 8-by-8 array
I8 = repmat(I, [8, 8]);
fh = figure;
imshow(I8, []);
title('Fraunhofer Diffraction', 'FontSize', 14)
set(fh, 'color', 'white');
axis('on', 'image');
0000 Screenshot.png
  2 个评论
Image Analyst
Image Analyst 2019-12-10
Why do you say that? I simply used repmat() on your equation. Your equation is correct for the amplitude in the case of a single rectangular aperture. Using repmat() makes it correct for the case of an infinite rectangular grid of such rectangular apertures.
For an infinite pattern, the pattern would extend to inifinity. The image is an 8-by-8 section of that infinite pattern.
For a non-infinite grid of rectangular apertures you'd have to multiply it by the 2-D sinc function of the extent of the grid, which would give a modulated sinc pattern since it's a sinc times a sinc.
For the intensity, rather than the amplitude, you'd have to square the image since intensity is amplitude squared.
If you change the intensity range
imshow(I8, [0, 1.5]);
you'll see the individual patterns better than just scaling the display between min and max intensity which is what imshow(I8, []); does. See:
0000 Screenshot.png
So, that's what I thought I learned while getting my Ph.D. in optics. Please explain why you say it's not a diffraction pattern -- maybe I'm wrong.

请先登录,再进行评论。

更多回答(1 个)

Stijn Haenen
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');

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by