What's the purpose of doing fftshift twice?
157 views (last 30 days)
John BG on 9 Jun 2016
command fftshift is used to visualise the FFT within [-Fs/2 Fs/2] instead of [0 Fs] that is the interval that the FFT takes as default.
Let be the following signal:
x=10*sin(t)+10*cos(t); % 2nd tone has phase shift equivalent to pi/4 rad
If you apply a frequency operation directly on time domain, for this example you get the following:
text(5.38,x0(find(t==5.38)),'\leftarrow 10*sin(t)','FontSize',14);grid on;
the typical phase imbalance oscilloscope also helps:
As explained in MATLAB help, there is further phase cross-over when working with 2D signals
. If you find this answer of any help solving your question
please mark it as accepted answer,
thanks in advance
More Answers (1)
Walter Roberson on 9 Jun 2016
No, if your data is in the time domain, then using fftshift(x) before usng fft() would only be before the case where you had negative time represented in your data and time zero was at the middle of the data. The first version you gave is significantly more likely for time domain data: it assumes the data starts at time 0 and it shifts the result of the fft so as to center the plot in the frequency domain.
You only use fftshift() twice if the data you are using fft() or ifft() on is centered in the array.