ifftshift - Inverse zero-frequency shift - MATLAB (original) (raw)
Main Content
Inverse zero-frequency shift
Syntax
Description
X = ifftshift([Y](#bvi4cjj-1-Y))
rearranges a zero-frequency-shifted Fourier transform Y
back to the original transform output. In other words, ifftshift
undoes the result of fftshift
.
- If
Y
is a vector, thenifftshift
swaps the left and right halves ofY
. - If
Y
is a matrix, thenifftshift
swaps the first quadrant ofY
with the third, and the second quadrant with the fourth. - If
Y
is a multidimensional array, thenifftshift
swaps half-spaces ofY
along each dimension.
X = ifftshift([Y](#bvi4cjj-1-Y),[dim](#bvi4cjj-1-dim))
operates along the dimension dim
of Y
. For example, if Y
is a matrix whose rows represent multiple 1-D transforms, then ifftshift(Y,2)
swaps the halves of each row of Y
.
Examples
You can use the fftshift
and ifftshift
functions to swap left and right halves of a vector.
Create a vector containing an odd number of elements, and swap the left and right sides of the vector using the fftshift
function.
V = [1 2 3 4 5 6 7]; X = fftshift(V)
Use the ifftshift
function to swap the left and right sides of X
. The result is the same as the original vector V
.
Calling the fftshift
function twice does not necessarily reconstruct the original input.
Rearrange the rows of a matrix to shift the nonnegative elements to the left.
Y = [-2 -1 0 1 2; -10 -5 0 5 10]; X = ifftshift(Y,2)
X = 2×5
0 1 2 -2 -1
0 5 10 -10 -5
Input Arguments
Input array, specified as a vector, a matrix, or a multidimensional array.
Data Types: double
| single
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| logical
Complex Number Support: Yes
Dimension to operate along, specified as a positive integer scalar. If no value is specified, then ifftshift
swaps along all dimensions.
- Consider an input matrix
Yc
. The operationifftshift(Yc,1)
swaps halves of each column ofYc
. - Consider an input matrix
Yr
. The operationifftshift(Yr,2)
swaps halves of each row ofYr
.
Data Types: double
| single
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| logical
Extended Capabilities
The ifftshift
function fully supports GPU arrays. To run the function on a GPU, specify the input data as a gpuArray (Parallel Computing Toolbox). For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Version History
Introduced before R2006a