2-D fast Fourier transform
Y = fft2(X)
Y = fft2(X,m,n)
If the dimensionality of X is greater than 2, the fft2 function returns the 2-D DFT for each higher dimensional slice of X. For example, if size(X) = [100 100 3], then fft2 computes the DFT of X(:,:,1), X(:,:,2) and X(:,:,3).
fft2 supports inputs of data types double and single. If you call fft2 with the syntax y = fft2(X, ...), the output y has the same data type as the input X.
fft2(X) can be simply computed as
This computes the one-dimensional DFT of each column X, then of each row of the result. The execution time for fft depends on the length of the transform. It is fastest for powers of two. It is almost as fast for lengths that have only small prime factors. It is typically several times slower for lengths that are prime or which have large prime factors.
Note You might be able to increase the speed of fft2 using the utility function fftw, which controls how MATLAB® software optimizes the algorithm used to compute an FFT of a particular size and dimension.