I am getting different values of fft for the same variable as demonstrated by a simple example below...

1 次查看(过去 30 天)
E=[1 2 4 6;3 6 3 9;7 5 8 9]
E = 3x4
1 2 4 6 3 6 3 9 7 5 8 9
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
EF=fftshift(abs(fft(E)))
EF = 3x4
4.5826 3.0000 5.2915 3.6056 15.0000 24.0000 11.0000 13.0000 4.5826 3.0000 5.2915 3.6056
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
ES=fftshift(abs(fft(E(:,1))))
ES = 3x1
5.2915 11.0000 5.2915
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
shouldn't ES be equal to the first row of EF...

回答(1 个)

Paul
Paul 2024-5-11
I think you were expecting ES be equal to the first column of EF.
If desired for fftshift to work along a specific dimension of the input, then that dimension needs to be specified
E=[1 2 4 6;3 6 3 9;7 5 8 9];
EF=fftshift(abs(fft(E)),1) % specify the dimension
EF = 3x4
5.2915 3.6056 4.5826 3.0000 11.0000 13.0000 15.0000 24.0000 5.2915 3.6056 4.5826 3.0000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
ES=fftshift(abs(fft(E(:,1))))
ES = 3x1
5.2915 11.0000 5.2915
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
If that second argument to fftshift is not specified, then the the 2D input is assumed to be a 2D fft, as might be produced from fft2, and the shifting is done in both dimensions.

类别

Help CenterFile Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by