Shift zero-frequency component to center of spectrum
Y = fftshift(X)
Y = fftshift(X,dim)
Y = fftshift(X) rearranges
the outputs of
fftn by moving the zero-frequency component
to the center of the array. It is useful for visualizing a Fourier
transform with the zero-frequency component in the middle of the spectrum.
fftshift(X) swaps the left and
right halves of
X. For matrices,
the first quadrant with the third and the second quadrant with the
For higher-dimensional arrays,
X along each dimension.
Y = fftshift(X,dim) applies
fftshift operation along the dimension
For any matrix
Y = fft2(X)
Y(1,1) = sum(sum(X)); the zero-frequency
component of the signal is in the upper-left corner of the two-dimensional
Z = fftshift(Y)
this zero-frequency component is near the center of the matrix.
N = 5; X = 0:N-1; Y = fftshift(fftshift(X)); Z = ifftshift(fftshift(X));
Z is a correct replica of
Y is not.
isequal(X,Y),isequal(X,Z) ans = 0 ans = 1