Frequency array 2d FFT
2 次查看(过去 30 天)
显示 更早的评论
Hello everyone, I am working of Fourier transform of images. I use the function fft2 to obtain the Fourier transform of my set of data and I apply the fftshift to center the zero frequency component. To construct the wavevector arrays of the x and y axis I simply do:
kx = (1/dx)*((-Nx/2:Nx/2-1)/Nx)
ky = (1/dy)*((-Ny/2:Ny/2-1)/Ny)
with dx (dy) being the spacing between x (y) points and Nx (Ny) total number of points. However by doing so, I have the feeling that I am mixing positive and negative frequencies. The tranform of all even points is positive and the one of the odd points is negative. What am I missing here? Should I just neglect the odd points?
Thanks to everyone
3 个评论
David Goodmanson
2020-12-7
Hello C,
[1] Suppose you are doing an fft from function y to function z. fft does the transform using array indices for y(n) and z(m), with a factor of exp(-2*pi*i*n*m/N), where N is the number of fft points [not counting some off-by-one details since Matlab is not zero-based]. You can make x and k arrays to go along with y and z, arrays that the fft does not use and really knows nothing about. The choice you made for the kx array means that the wave in the k domain goes like exp(2*pi*i*kx*x). The second option I mentioned incorporates the 2*pi into kx, so the wave goes like exp(i*kx*k).
[2] The checkerboard effect often happens because of not using fftshift when it should be used, or using it when it should not. For example, suppose you have data in the time domain, fft it and use fftshift in the frequency domain to put f = 0 at the center. Then suppose you modify it in the frequency domain somehow and use ifft to transform back to the time domain. Before transforming back, you have to use ifftshift first to put f = 0 back down to the first array point.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!