SignalProcessing - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Science and Engineering : Signal Processing : Conversions : SignalProcessing/FFTShift

SignalProcessing

  

FFTShift

  

swap quadrants of arrays

  

InverseFFTShift

  

swap quadrants of arrays

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

FFTShift(A)

FFTShift(A, dimension)

InverseFFTShift(A)

InverseFFTShift(A, dimension)

Parameters

A

-

rtable

dimension

-

integer, [integer], identical(all, "all", default, "default") 

Description

• 

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.

Examples

withSignalProcessing:

withImageTools:

AVector5,0.,2.,4.,4.,2.

A0.2.4.4.2.

(4.1)

A1FFTShiftA

A14.2.0.2.4.

(4.2)

InverseFFTShiftA1

0.2.4.4.2.

(4.3)

BMatrix1..3,1..3,i,j→j+3i1

B123456789

(4.4)

B1FFTShiftB

B1978312645

(4.5)

InverseFFTShiftB1

123456789

(4.6)

C1Array1..2,1..2,1..2,i,j,k→j+2i1+4k1:

C1..,..,1

1234

(4.7)

C1..,..,2

5678

(4.8)

C2FFTShiftC1,2

C22143slice of 2 × 2 × 2 Array

(4.9)

C2..,..,1

2143

(4.10)

C2..,..,2

6587

(4.11)

C3InverseFFTShiftC2,2

C31234slice of 2 × 2 × 2 Array

(4.12)

C3..,..,1

1234

(4.13)

C3..,..,2

5678

(4.14)

imgReadcatkerneloptsdatadir,/images/tree.jpg:

EmbedCreateimg

img1FFTimg,dimension=1,2:

img1PowerSpectrumimg1:

EmbedCreateimg1

img2FFTShiftimg1:

EmbedCreateimg2

img3InverseFFTShiftimg2:

Embedimg3

Compatibility

• 

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

SignalProcessing[FFT]