Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Shift the zero-frequency term to the center of the spectrum
ResourceFunction["FourierShift"][data] rearranges a Fourier transform data by shifting the zero-frequency term to the center of the array. | |
ResourceFunction["FourierShift"][data,dim] operates along the dimension dim of data. |
Swap the left and right halves of a vector:
| In[1]:= |
| Out[1]= |
If a vector has an odd number of elements, then the shift moves the first element to the center:
| In[2]:= |
| Out[2]= |
Swap the first quadrant of the matrix with the third, and the second quadrant with the fourth:
| In[3]:= | ![]() |
| Out[3]= |
Swap halves of each column of matrix:
| In[4]:= | ![]() |
| Out[4]= |
Swap halves of each row instead:
| In[5]:= | ![]() |
| Out[5]= |
FourierShift can be applied to a multidimensional array:
| In[6]:= | ![]() |
| Out[6]= | ![]() |
The dimension can be any valid part specification:
| In[7]:= | ![]() |
| Out[7]= | ![]() |
| In[8]:= | ![]() |
| Out[8]= | ![]() |
For Fourier, the zero-frequency term appears at position 1 in the resulting list:
| In[9]:= |
| Out[8]= | ![]() |
FourierShift shifts zero-frequency term to center of spectrum:
| In[10]:= |
| Out[10]= | ![]() |
FourierShift does not support ragged arrays:
| In[11]:= |
| Out[11]= |
Calling FourierShift twice does not necessarily reconstruct the original input:
| In[12]:= |
| Out[12]= |
This work is licensed under a Creative Commons Attribution 4.0 International License