A MATLAB user recently contacted tech support with a question about the output of fft2. The user had a function, q(x,y), evaluated on an (x,y) grid. The grid evaluation produced a matrix that the user passed to fft2. The user's question: what are the spatial frequencies associated with the elements of the output from fft2?
The question was forwarded to the MATLAB Math team. Chris Turnes, a fellow Georgia Tech grad, answered it. Here is Chris' answer, lightly edited.
To map discrete Fourier coefficients into samples of the corresponding Discrete Time Fourier Transform, we need to know about the sampling pattern of the spatial signal. Since the customer presumably has the vectors x and y that she used to query the continuous function q(x,y), this ought to be easy to determine.
To determine the sampling frequencies, we use the spacing of the sampling grid. The sampling frequencies in each dimension are fsx = 1/(x(2)-x(1)) and fsy = 1/(y(2)-y(1)) if the grid is uniform in each dimension.
Next, the normalized DFT frequencies of a (shifted) N-point DFT (where N here is even for convenience) are fa = ((-N/2):(N/2-1))/N. Therefore, the corresponding DTFT frequency grid would be composed of the frequencies fcx = fa*fsx and fcy = fa*fsy. That would be the correct way to do the mapping between FFT coefficients and the corresponding continuous spatial frequency.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.