High Resolution fft2 image

15 visualizaciones (últimos 30 días)
Matthew Worker
Matthew Worker el 24 de Abr. de 2021
Comentada: David Goodmanson el 30 de Abr. de 2021
Hello All,
Please help me on the following- I need to construct an Fourier Transormed image such an Fig.1, But so far I have got my result like Fig.2 with expected pattern but low resulation. How could I edit my cod to get the expected high resultaion result? Please help me. I am adding my code here.
L=10*pi;
M=1000;
x = linspace(-L,L,M);
[X, Y] = meshgrid(x, x);
%pentagonal
N=5;
Quasi = zeros(size(X));
phi = linspace(2*pi/N,2*pi,N);
for i =1:N
for i=1:N
Quasi = Quasi + exp((1j*(sin(phi(i))*X +cos(phi(i))*Y)));
end
end
figure(1)
colormap jet
pcolor(X, Y, real(Quasi));shading interp
%% 2d Fourier transform
F = fft2(abs(Quasi));
imagesc(abs(fftshift(F))); colormap gray;
  1 comentario
Rena Berman
Rena Berman el 29 de Abr. de 2021
(Answers Dev) Restored edit

Iniciar sesión para comentar.

Respuesta aceptada

David Goodmanson
David Goodmanson el 25 de Abr. de 2021
Editada: David Goodmanson el 27 de Abr. de 2021
The nested for loops use the same variable i, meaning that the outer one doesn't do anything except run through the inner one five times, spending time at it. You can reduce the for loops to just one, with the same result only faster.
There are a couple of ways to see something. If you drop the abs and use
F = fft2(Quasi);
then zoom in to the center of the image, you can see points in a nice pentagon pattern, representing the five wave components. If abs is part of the problem specification (because a density is being modeled or something similar), then there is a large nonzero average for all the elements of abs(Quasi). That leads to a very large DC component in the fft, right at the very center of the image. Hard to see anything else. You can remove the DC component and see a good pattern (after zooming in) with
aQ = abs(Quasi);
F = fft2(aQ-mean(mean(aQ)));
Incidentally, although it did not matter in this case, it is best to use
F = fft2(ifftshift(aQ-mean(mean(aQ))));
That's because you constructed the spacial array with x=0, y=0 at the center of the array, and ifftshift puts (0,0) at the corner of the array where fft2 expects it to be.
  3 comentarios
David Goodmanson
David Goodmanson el 26 de Abr. de 2021
Editada: John Kelly el 27 de Abr. de 2021
Could you restore your code (say, leaving out the extra for loop) and return to the original problem statement? In the edited question there is not really enough information to see the nature of the problem any more. (I would like to make an additional comment which hopefully will add some clarity but can't do so at present, and others might weigh in on the original question ).
David Goodmanson
David Goodmanson el 30 de Abr. de 2021
There are approximately 10 cycles over the width of the window, also over the height of the window. This means that for the frequency domain, the pattern has its strongest peaks approximateiy 10 array elements away from the origin. Since the image is 1000x100 points, zooming will be necessary in order to see them. That's just a feature of the fft.
Since the waves are at an angle to the x and y axes, there are not an exact integral number of cycles across the height or width. This means that in the frequency domain you do not see perfectly sharp peaks, but rather some blurring of them.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by