understanding FFT2 function of Matlab
The fft() function calculates the one-dimensional FFT of its input argument. If the input argument is a vector, then the operation is pretty simple to understand; the output is just the result of efficiently calculating a discrete Fourier transform on the input. If the input is a matrix, then, as many MATLAB functions do, each column is treated as a separate one-dimensional signal and are transformed separately. Therefore, the $n$-th column of the output matrix corresponds to the DFT of the $n$-th column of the input matrix.

The fft2() function calculates the two-dimensional FFT of a matrix. One way of envisioning this operation is to take standard one-dimensional FFTs down each column of the input matrix $A$ to yield a temporary result $B$. Then, take one-dimensional FFTs across each row of $B$ to yield the result $C$. The matrix $C$ would then be the result of the two-dimensional FFT of A. 2-D transforms (although not typically the FFT) are often used in image and video compression algorithms.