function [output1, output2] = fft2D(input)
output1 = input';
output1 = fft(output1);
output1 = output1';
output1 = fft(output1);
output2 = fft2(input);
end
So, I calculate on output2 a 2D FFT inputand on output1 the same 2D FFT input. fft()applied to a two-dimensional FFT matrix over column vectors. So above I apply it row by row, and then column by column.
However, for a random matrix
[1 1 4 1;
12 13 124 1;
12 2 2 1;
1 1 1 0]
my output1:
1.0e+02 *
1.7700 + 0.0000i -1.0500 + 0.1400i 1.3700 + 0.0000i -1.0500 - 0.1400i
-0.1000 - 1.4700i -0.0200 + 1.1100i -0.0800 - 1.2100i -0.2400 + 1.1300i
-1.2900 + 0.0000i 1.1900 - 0.1200i -1.0900 + 0.0000i 1.1900 + 0.1200i
-0.1000 + 1.4700i -0.2400 - 1.1300i -0.0800 + 1.2100i -0.0200 - 1.1100i
and my output2-
1.0e+02 *
1.7700 + 0.0000i -1.0500 - 0.1400i 1.3700 + 0.0000i -1.0500 + 0.1400i
-0.1000 - 1.4700i -0.2400 + 1.1300i -0.0800 - 1.2100i -0.0200 + 1.1100i
-1.2900 + 0.0000i 1.1900 + 0.1200i -1.0900 + 0.0000i 1.1900 - 0.1200i
-0.1000 + 1.4700i -0.0200 - 1.1100i -0.0800 + 1.2100i -0.2400 - 1.1300i
They have the same meanings, but change places in different positions! This made me go crazy for a long time because from what I read online, 2D FFT can be done by applying 1D FFT row by row and then column by column. Any help or suggestion would be great!
source
share