2D FFT: problems with fftshift + setting up wavenumbers
Show older comments
Hi,
My i/p data is an (NxN) matrix, whose elements S(x,y) describe some kind intensity over a 2D region.
I want to perform a 2D Fourier transform on this data, which I tried to do as follows:
F = fft2(S); F2 = fftshift(F); F3=abs(F3); imshow(abs(F3));
I tried to set the wavevectors as below:
N=50; kx1 =mod(1/2+(0:(N-1))/N, 1)-1/2; kx = kx1*(2*pi/delta);
ky1 = mod(1/2 + (0:(N-1))/N,1)-1/2; ky = ky1*(2*pi/delta);
[p,q]=meshgrid(kx,ky);
Now when i try to do a contour plot using h2=contourf(p,q,F3); i find that(kx,ky)=0 is not at the center. If I use fftshift a second time h2=contourf(p,q,fftshift(F3)); then get the DC component at the center. But please note that F3 is already fftshift-ed.Can someone please tell me what is going on?
Secondly, I want to keep the wavenumbers only upto the Nyquist wavenumber and throw away the symmetrically redundant ones. How does one do this?
Thirdly, how i can be sure that when i plot contourf(p,q,F3), i am plotting F3 at the corresponding wavenumbers?
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!