MATLAB Answers

How to draw multiple rectangular diffraction pattern

4 ビュー (過去 30 日間)
Yi-Jing Pan
Yi-Jing Pan 2019 年 12 月 8 日
Commented: Image Analyst 2019 年 12 月 10 日
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');

  0 件のコメント

サインイン to comment.

採用された回答

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 件のコメント

Yi-Jing Pan
Yi-Jing Pan 2019 年 12 月 10 日
sorry it not a Diffraction pattern
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.

サインイン to comment.

More Answers (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');

  2 件のコメント

Image Analyst
Image Analyst 2019 年 12 月 8 日
0000 Screenshot.png
Yi-Jing Pan
Yi-Jing Pan 2019 年 12 月 10 日
Sorry.
My matlab can't run this code..

サインイン to comment.

サインイン してこの質問に回答します。

タグ


Translated by