Learn R Programming

AIUQ (version 0.5.3)

fftshift: fftshift

Description

Rearranges a 2D Fourier transform x by shifting the zero-frequency component to the center of the matrix.

Usage

fftshift(x, dim = -1)

Value

Shifted matrix.

Arguments

x

square matrix input with odd number of rows and columns

dim

shift method. See 'Details'.

Author

tools:::Rd_package_author("AIUQ")

Details

By default, dim=-1, swaps the first quadrant of x with the third, and the second quadrant with the fourth. If dim=1, swaps rows 1 to middle with rows (middle+1) to end. If dim=2, swaps columns 1 to middle with columns (middle+1) to end. If dim=3, reverse fftshift.

Examples

Run this code
library(AIUQ)

(m <- matrix(0:8,3,3))
fftshift(m)

Run the code above in your browser using DataLab