Fast Fourier Transform (FFT) function won't work for more than 1x1 array of circular apertures
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Viron Gil Estrada
el 19 de Feb. de 2018
Comentada: Viron Gil Estrada
el 26 de Feb. de 2018
Below is a program that generates an NxN array of circular apertures and uses fast fourier transform (FFT) function to produce a diffraction pattern.
n_circles=4 % Define the number of circles to be plotted
n0 = (2^10)/n_circles; % Define the size of the basic mask
M0 = zeros(n0); % Initialize the basic mask
I = 1:n0; % Define the x and y coordinates of the basic mask
x = I - n0/2;
y = n0/2 - I;
[X,Y] = meshgrid(x,y); % Create the mask
R = n0/2; % Define the radius of the basic circle
A = (X.^2 + Y.^2 <= R^2); % Get the indices of the points inside the basic circle
M0(A) = 1; % Set basic mask
figure
M=repmat(M0,n_circles,n_circles); % Replicate basic mask according to the number of circles to be plotted
imagesc(M)
daspect([1 1 1])
%Fast fourier transform (FFT)
DP = fftshift(fft2(M));
imagesc(abs(DP))
axis image
imagesc(abs(log2(DP)))
axis image
When the number of circles (n_circles) is 1, the output looks right, as shown in figure 1. But when the n_circles is raised to a number higher than 1, the program produces bad results. As an example, figure 2 shows the result for a 2 by 2 array of circles.
figure 1. result for 1 circular aperture.
figure 2. result for 2 by 2 array of circular apertures.
Can anyone help me fix the problem? Thanks.
0 comentarios
Respuesta aceptada
David Goodmanson
el 20 de Feb. de 2018
Hi Viron,
While there is a diffraction pattern of a kind, it is not what is usually associated with diffraction by a circular aperture. The issue is aperture size, which is so large that almost everything goes through unaffected. Basically it’s a ray model. If you go to n = 1 (I am going to use n for n_circles), plot DP with
imagesc(abs(DP)), colorbar
and zoom in on the center of the plot, you will see a yellow dot at k = 0. That is the diffraction 'pattern'. There is a small amount of diffraction from the edge of the aperture as seen in the third image.
The smaller the aperture, the wider the diffraction pattern. If you put n = 1 and make the aperture a lot smaller, say R = 20, then DP shows a nice pattern.
For multiple apertures, the code below makes even R smaller so that the diffraction pattern is wider, and zooms in. It keeps R at a constant size. That way as n increases, two things are not happening at once. (The method used to zerofill M is not exactly recommended, but it works).
Multiple equally spaced apertures give [the single aperture pattern] x [the diffraction pattern for multiple narrow slits]. The visuals are not crystal clear, but for increasing n, the spacing between the apertures decreases and the width of the slit pattern increases.
It turns out that if the aperture spacing exactly divides the size of the array, the fft can't reproduce the slit diffraction pattern very well at all, and you get some funky stuff going on. As with what you saw for n = 2. Here I made a deliberate attempt to have a spacing that does not divide 2^10.
n_circles = 2 % Define the number of circles to be plotted
n0 = round(1023/n_circles); % Define the size of the basic mask
M0 = zeros(n0); % Initialize the basic mask
I = 1:n0; % Define the x and y coordinates of the basic mask
x = I - n0/2;
y = n0/2 - I;
[X,Y] = meshgrid(x,y); % Create the mask
R = 4; % Define the radius of the basic circle
A = (X.^2 + Y.^2 <= R^2); % Get the indices of the points inside the basic circle
M0(A) = 1; % Set basic mask
M=repmat(M0,n_circles,n_circles); % Replicate basic mask according to the number of circles to be plotted
M(2^10,2^10) = 0; % zerofill the rest of the matrix
figure(1)
imagesc(M)
daspect([1 1 1])
%Fast fourier transform (FFT)
DP = fftshift(fft2(M));
figure(2)
imagesc(abs(DP(300:700,300:700))), colorbar
axis image
figure(3)
imagesc(abs(log2(DP)))
axis image
3 comentarios
David Goodmanson
el 22 de Feb. de 2018
Hi Viron,
You can certainly make sets of circles that touch each other. Suppose you do that for, say, a 5x5 array if circles of size R = 4, so matrix M1 has size 40x40 all together. Then you can insert that into the middle of the larger array with
M = zeros(1024,1024);
M(492:531,492:531) = M1;
Más respuestas (0)
Ver también
Categorías
Más información sobre Fourier Analysis and Filtering en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!