When X is a multidimensional array, fft2 computes the 2-D Fourier transform on the first two dimensions of each subarray of X that can be treated as a 2-D matrix for dimensions higher than 2. For example, if X is an m -by- n -by- 1 -by- 2 array, then Y(:,:,1,1) = fft2(X(:,:,1,1)) and Y(:,:,1,2) = fft2(X(:,:,1,2)) .