SignalProcessing
FFTShift
swap quadrants of arrays
InverseFFTShift
Calling Sequence
Parameters
Description
Examples
Compatibility
FFTShift(A)
FFTShift(A, dimension)
InverseFFTShift(A)
InverseFFTShift(A, dimension)
A
-
rtable
dimension
integer, [integer], identical(all, "all", default, "default")
The FFTShft(A) command swaps quadrants of A. It is usually applied to the Fourier Transform of a signal. In this case, it moves the zero-frequency elements to the center of A.
The InverseFFTShift(A) inverses the changes did by FFTShift and moves the zero-frequency elements back to the corner of A.
If FFTShift(A, dimension) is used, then InverseFFTShift(A, dimension) should be used with the same dimension.
For FFTShift(A, dimension), if dimension is provided as an integer, then A is split in half from the middle of the specified dimension, and these two parts are swapped. When the specified dimension is odd, the first half has one more layer of the specified dimension than the second half. dimension can also be a list of integers which means FFTShift would be applied to A for all the specified dimensions in the list. If dimension is specified as "all" or all, then A is swapped for all dimensions. If dimension is specified as "default" or default, and A is an image, then FFTShift will be applied to each layer and A would not be swapped for the last dimension. When A is not an image, specifying dimension to "all", all, "default" or default has the same effect. For an array with dimensions higher than 2, dimension must be specified. The default value for dimension is default.
InverseFFTShift command does almost the same thing as FFTShift, only for the odd dimension, the split is different: the first half has one layer fewer of the specified dimension than the second half.
If A is a one-dimensional Array with n elements, then FFTShift(A) swaps A[1..ceil(n/2)] (first half) with A[ceil(n/2)+1..n] (second half) and InverseFFTShift(A) swaps A[1..floor(n/2)] (first half) with A[floor(n/2)+1..n] (second half)
If A is an m by n Array or Matrix, then FFTShift(A) swaps A[1..ceil(m/2), 1..ceil(n/2)] (first quadrant) with A[ceil(m/2) + 1..m, ceil(n/2) + 1..n] (third quadrant) and A[1..ceil(m/2), ceil(n/2) + 1..n] (second quadrant) with A[ceil(m/2) + 1..m, 1..ceil(n/2)] (fourth quadrant). InverseFFTShift(A) does the same thing excepts for using floor instead of ceil.
with⁡SignalProcessing:
with⁡ImageTools:
A≔Vector⁡5,0.,2.,4.,−4.,−2.
A≔
A1≔FFTShift⁡A
A1≔
InverseFFTShift⁡A1
B≔Matrix⁡1..3,1..3,i,j↦j+3⋅i−3
B≔
B1≔FFTShift⁡B
B1≔
InverseFFTShift⁡B1
C1≔Array⁡1..2,1..2,1..2,i,j,k↦j+2⋅i−6+4⋅k:
C1..,..,1
C1..,..,2
C2≔FFTShift⁡C1,2
C2..,..,1
C2..,..,2
C3≔InverseFFTShift⁡C2,2
C3..,..,1
C3..,..,2
img≔Read⁡cat⁡kernelopts⁡datadir,/images/tree.jpg:
Embed⁡Create⁡img
img1≔FFT⁡img,dimension=1,2:
img1≔PowerSpectrum⁡img1:
Embed⁡Create⁡img1
img2≔FFTShift⁡img1:
Embed⁡Create⁡img2
img3≔InverseFFTShift⁡img2:
Embed⁡img3
The SignalProcessing[FFTShift] and SignalProcessing[InverseFFTShift] commands were introduced in Maple 2019.
For more information on Maple 2019 changes, see Updates in Maple 2019.
See Also
SignalProcessing[FFT]
Download Help Document