문제

Please, see the the description of both fftshift and ifftshift. I would like to understand how to call the above two functions in relationship with fft and fftn in Matlab.

Let say that my signal has a certain frequency content; now, the frequency array can generally be stored as:

f = (-N/2:N/2-1)*df;

f = (1:N)*(df/2);

f = [(0:N/2-1) (-N/2:-1)];

What is the best way to call fft, coupled with fftshift and ifftshift, for the 3 study cases early mentioned?

What is the effect on the standard deviation of the signal of calling the sequence of commands or the wrong one?

도움이 되었습니까?

해결책

The result of fft is (in your notation) indices (0:N-1). fftshift simply converts that to [(N/2:N-1) (0:(N/2-1))].* ifftshift simply restores the original indexing.

As this is simply reordering samples, it does nothing to the standard deviation.


* Note that due to periodicity, sample k is equivalent to sample k+N, or k-N, etc.

다른 팁

Matlab documentation is just killing about it. But experiments show that

ifftshift([1 2 3 4 5])

ans =

 3     4     5     1     2

fftshift([1 2 3 4 5])

ans =

 4     5     1     2     3

It is just swapping around the magic DFT position [N/2]. FFT implemented in matlab use usual indexing (0:N-1). As I understand this is extra functions to prepare your input to DFT if your setup is dicrete function not in (0:N-1)...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top