Function Reference
— Function File: fftshift (v)
— Function File: fftshift (v, dim)

Perform a shift of the vector v, for use with the fft and ifft functions, in order the move the frequency 0 to the center of the vector or matrix.

If v is a vector of N elements corresponding to N time samples spaced of Dt each, then fftshift (fft (v)) corresponds to frequencies

          f = ((1:N) - ceil(N/2)) / N / Dt

If v is a matrix, the same holds for rows and columns. If v is an array, then the same holds along each dimension.

The optional dim argument can be used to limit the dimension along which the permutation occurs.