ifftn

Multidimensional inverse fast Fourier transform

Description

example

X = ifftn(Y) returns the multidimensional discrete inverse Fourier transform of an N-D array using a fast Fourier transform algorithm. The N-D inverse transform is equivalent to computing the 1-D inverse transform along each dimension of Y. The output X is the same size as Y.

example

X = ifftn(Y,sz) truncates Y or pads Y with trailing zeros before taking the inverse transform according to the elements of the vector sz. Each element of sz defines the length of the corresponding transform dimension. For example, if Y is a 5-by-5-by-5 array, then X = ifftn(Y,[8 8 8]) pads each dimension with zeros, resulting in an 8-by-8-by-8 inverse transform X.

example

X = ifftn(___,symflag) specifies the symmetry of Y. For example, ifftn(Y,'symmetric') treats Y as conjugate symmetric.

Examples

collapse all

You can use the ifftn function to convert multidimensional data sampled in frequency to data sampled in time or space. The ifftn function also allows you to control the size of the transform.

Create a 3-by-3-by-3 array and compute its inverse Fourier transform.

Y = rand(3,3,3);
ifftn(Y);

Pad the dimensions of Y with trailing zeros so that the transform has size 8-by-8-by-8.

X = ifftn(Y,[8 8 8]);
size(X)
ans = 1×3

8     8     8

For nearly conjugate symmetric arrays, you can compute the inverse Fourier transform faster by specifying the 'symmetric' option, which also ensures that the output is real.

Compute the 3-D inverse Fourier transform of a nearly conjugate symmetric array.

Y(:,:,1) = [1e-15*i 0; 1 0];
Y(:,:,2) = [0 1; 0 1];
X = ifftn(Y,'symmetric')
X =
X(:,:,1) =

0.3750   -0.1250
-0.1250   -0.1250

X(:,:,2) =

-0.1250    0.3750
-0.1250   -0.1250

Input Arguments

collapse all

Input array, specified as a vector, a matrix, or a multidimensional array. If Y is of type single, then ifftn natively computes in single precision, and X is also of type single. Otherwise, X is returned as type double.

Data Types: double | single | int8 | int16 | int32 | uint8 | uint16 | uint32 | logical
Complex Number Support: Yes

Lengths of inverse transform dimensions, specified as a vector of positive integers.

Data Types: double | single | int8 | int16 | int32 | uint8 | uint16 | uint32 | logical

Symmetry type, specified as 'nonsymmetric' or 'symmetric'. When Y is not exactly conjugate symmetric due to round-off error, ifftn(Y,'symmetric') treats Y as if it were conjugate symmetric. For more information on conjugate symmetry, see Algorithms.

collapse all

N-D Inverse Fourier Transform

The discrete inverse Fourier transform X of an N-D array Y is defined as

${X}_{{p}_{1},{p}_{2},...,{p}_{N}}=\sum _{{j}_{1}=1}^{{m}_{1}}\frac{1}{{m}_{1}}{\omega }_{{m}_{1}}^{{p}_{1}{j}_{1}}\sum _{{j}_{2}=1}^{{m}_{2}}\frac{1}{{m}_{2}}{\omega }_{{m}_{2}}^{{p}_{2}{j}_{2}}...\sum _{{j}_{N}=1}^{{m}_{N}}\frac{1}{{m}_{N}}{\omega }_{{m}_{N}}^{{p}_{N}{j}_{N}}{Y}_{{j}_{1},{j}_{2},...,{j}_{N}}.$

Each dimension has length mk for k = 1,2,...,N, and ${\omega }_{{m}_{k}}={e}^{2\pi i/{m}_{k}}$ are complex roots of unity where i is the imaginary unit.

Algorithms

• The ifftn function tests whether the vectors in an array Y are conjugate symmetric in all dimensions. A vector v is conjugate symmetric when the ith element satisfies v(i) = conj(v([1,end:-1:2])). If the vectors in Y are conjugate symmetric in all dimensions, then the inverse transform computation is faster and the output is real.