# High Resolution fft2 image

조회 수: 14(최근 30일)
Matthew Worker 2021년 4월 24일
댓글: David Goodmanson 2021년 4월 30일
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
%% 2d Fourier transform
F = fft2(abs(Quasi));
imagesc(abs(fftshift(F))); colormap gray;
##### 댓글 수: 1표시숨기기 없음
Rena Berman 2021년 4월 29일

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

### 채택된 답변

David Goodmanson 2021년 4월 25일
편집: David Goodmanson 2021년 4월 27일
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표시숨기기 이전 댓글 수: 2
David Goodmanson 2021년 4월 30일
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.

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

### Community Treasure Hunt

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

Start Hunting!

Translated by