필터 지우기
필터 지우기

How to draw multiple rectangular diffraction pattern

조회 수: 8 (최근 30일)
Yi-Jing Pan
Yi-Jing Pan 2019년 12월 8일
댓글: 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');

채택된 답변

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.

댓글을 달려면 로그인하십시오.

추가 답변 (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
Yi-Jing Pan
Yi-Jing Pan 2019년 12월 10일
편집: Yi-Jing Pan 2019년 12월 10일
Sorry.
My matlab can't run this code..

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by