Learn R Programming

mrbsizeR (version 1.3)

ifftshift: Inverse FFT shift of a 2d matrix.

Description

ifftshift is an R equivalent to the Matlab function ifftshift applied on matrices. For more information about ifftshift see the Matlab documentation.

Usage

ifftshift(inputMatrix, dimension = -1)

Value

Swapped matrix.

Arguments

inputMatrix

Matrix to be swapped.

dimension

Which swap should be performed?

  • 1: swap halves along the rows.

  • 2: swap halves along the columns.

  • -1: swap first quadrant with third and second quadrant with fourth.

Details

ifftshift is the inverse function to fftshift. For more information see the details of fftshift

Examples

Run this code
set.seed(987)
sampleMat <- matrix(sample(1:10, size = 25, replace = TRUE), nrow = 5)

# Swap halves along the rows:
ifftshift(sampleMat, dimension = 1)

# Swap halves along the columns:
ifftshift(sampleMat, dimension = 2)

# Swap first quadrant with third and second quadrant with fourth:
ifftshift(sampleMat, dimension = -1)

Run the code above in your browser using DataLab