# ifft

Inverse fast Fourier transform

## Description

`X = ifft(`

computes
the inverse discrete Fourier transform of `Y`

)`Y`

using
a fast Fourier transform algorithm. `X`

is the same
size as `Y`

.

If

`Y`

is a vector, then`ifft(Y)`

returns the inverse transform of the vector.If

`Y`

is a matrix, then`ifft(Y)`

returns the inverse transform of each column of the matrix.If

`Y`

is a multidimensional array, then`ifft(Y)`

treats the values along the first dimension whose size does not equal 1 as vectors and returns the inverse transform of each vector.

## Examples

### Inverse Transform of Vector

The Fourier transform and its inverse convert between data sampled in time and space and data sampled in frequency.

Create a vector and compute its Fourier transform.

X = [1 2 3 4 5]; Y = fft(X)

`Y = `*1×5 complex*
15.0000 + 0.0000i -2.5000 + 3.4410i -2.5000 + 0.8123i -2.5000 - 0.8123i -2.5000 - 3.4410i

Compute the inverse transform of `Y`

, which is the same as the original vector `X`

.

ifft(Y)

`ans = `*1×5*
1 2 3 4 5

### Padded Inverse Transform of Matrix

The `ifft`

function allows you to control the size of the transform.

Create a random 3-by-5 matrix and compute the 8-point inverse Fourier transform of each row. Each row of the result has length 8.

Y = rand(3,5); n = 8; X = ifft(Y,n,2); size(X)

`ans = `*1×2*
3 8

### Conjugate Symmetric Vector

For nearly conjugate symmetric vectors, you can compute the inverse Fourier transform faster by specifying the `'symmetric'`

option, which also ensures that the output is real. Nearly conjugate symmetric data can arise when computations introduce round-off error.

Create a vector `Y`

that is nearly conjugate symmetric and compute its inverse Fourier transform. Then, compute the inverse transform specifying the `'symmetric'`

option, which eliminates the nearly 0 imaginary parts.

Y = [1 2:4+eps(4) 4:-1:2]

`Y = `*1×7*
1.0000 2.0000 3.0000 4.0000 4.0000 3.0000 2.0000

X = ifft(Y)

`X = `*1×7 complex*
2.7143 + 0.0000i -0.7213 + 0.0000i -0.0440 - 0.0000i -0.0919 + 0.0000i -0.0919 - 0.0000i -0.0440 + 0.0000i -0.7213 - 0.0000i

`Xsym = ifft(Y,'symmetric')`

`Xsym = `*1×7*
2.7143 -0.7213 -0.0440 -0.0919 -0.0919 -0.0440 -0.7213

## Input Arguments

`Y`

— Input array

vector | matrix | multidimensional array

Input array, specified as a vector, a matrix, or a multidimensional
array. If `Y`

is of type `single`

,
then `ifft`

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

`n`

— Inverse transform length

`[]`

(default) | nonnegative integer scalar

Inverse transform length, specified as `[]`

or
a nonnegative integer scalar. Padding `Y`

with zeros
by specifying a transform length larger than the length of `Y`

can
improve the performance of `ifft`

. The length is
typically specified as a power of 2 or a product of small prime numbers.
If `n`

is less than the length of the signal, then `ifft`

ignores
the remaining signal values past the `n`

th entry
and returns the truncated result. If `n`

is 0, then `ifft`

returns
an empty matrix.

**Data Types: **`double`

| `single`

| `int8`

| `int16`

| `int32`

| `uint8`

| `uint16`

| `uint32`

| `logical`

`dim`

— Dimension to operate along

positive integer scalar

Dimension to operate along, specified as a positive integer
scalar. By default, `dim`

is the first array dimension
whose size does not equal 1. For example, consider a matrix `Y`

.

`ifft(Y,[],1)`

returns the inverse Fourier transform of each column.`ifft(Y,[],2)`

returns the inverse Fourier transform of each row.

**Data Types: **`double`

| `single`

| `int8`

| `int16`

| `int32`

| `uint8`

| `uint16`

| `uint32`

| `logical`

`symflag`

— Symmetry type

`'nonsymmetric'`

(default) | `'symmetric'`

Symmetry type, specified as `'nonsymmetric'`

or `'symmetric'`

.
When `Y`

is not exactly conjugate symmetric due to
round-off error, `ifft(Y,'symmetric')`

treats `Y`

as
if it were conjugate symmetric. For more information on conjugate
symmetry, see Algorithms.

## More About

### Discrete Fourier Transform of Vector

`Y = fft(X)`

and ```
X
= ifft(Y)
```

implement the Fourier transform and inverse Fourier
transform, respectively. For `X`

and `Y`

of
length `n`

, these transforms are defined as follows:

$$\begin{array}{l}Y(k)={\displaystyle \sum _{j=1}^{n}X}(j)\text{\hspace{0.17em}}{W}_{n}^{(j-1)\text{}(k-1)}\\ X(j)=\frac{1}{n}{\displaystyle \sum _{k=1}^{n}Y}(k)\text{\hspace{0.17em}}{W}_{n}{}^{-(j-1)\text{}(k-1)},\end{array}$$

where

$${W}_{n}={e}^{(-2\pi i)/n}$$

is one of *n* roots
of unity.

## Algorithms

The

`ifft`

function tests whether the vectors in`Y`

are conjugate symmetric. A vector`v`

is conjugate symmetric when it equals`conj(v([1,end:-1:2]))`

. If the vectors in`Y`

are conjugate symmetric, then the inverse transform computation is faster and the output is real.

## Extended Capabilities

### C/C++ Code Generation

Generate C and C++ code using MATLAB® Coder™.

Usage notes and limitations:

Output is complex.

Symmetry type

`'symmetric'`

is not supported.For limitations related to variable-size data, see Variable-Sizing Restrictions for Code Generation of Toolbox Functions (MATLAB Coder).

For MEX output, MATLAB

^{®}Coder™ uses the library that MATLAB uses for FFT algorithms. For standalone C/C++ code, by default, the code generator produces code for FFT algorithms instead of producing FFT library calls. To generate calls to a specific installed FFTW library, provide an FFT library callback class. For more information about an FFT library callback class, see`coder.fftw.StandaloneFFTW3Interface`

(MATLAB Coder).For simulation of a MATLAB Function block, the simulation software uses the library that MATLAB uses for FFT algorithms. For C/C++ code generation, by default, the code generator produces code for FFT algorithms instead of producing FFT library calls. To generate calls to a specific installed FFTW library, provide an FFT library callback class. For more information about an FFT library callback class, see

`coder.fftw.StandaloneFFTW3Interface`

(MATLAB Coder).Using the Code Replacement Library (CRL), you can generate optimized code that runs on ARM

^{®}Cortex^{®}-A processors with Neon extension. To generate this optimized code, you must install the Embedded Coder^{®}Support Package for ARM Cortex-A Processors (Embedded Coder Support Package for ARM Cortex-A Processors). The generated code for ARM Cortex-A uses the Ne10 library. For more information, see Ne10 Conditions for MATLAB Functions to Support ARM Cortex-A Processors (Embedded Coder Support Package for ARM Cortex-A Processors).Using the Code Replacement Library (CRL), you can generate optimized code that runs on ARM Cortex-M processors. To generate this optimized code, you must install the Embedded Coder Support Package for ARM Cortex-M Processors (Embedded Coder Support Package for ARM Cortex-M Processors). The generated code for ARM Cortex-M uses the CMSIS library. For more information, see CMSIS Conditions for MATLAB Functions to Support ARM Cortex-M Processors (Embedded Coder Support Package for ARM Cortex-M Processors).

### GPU Code Generation

Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

Usage notes and limitations:

Output is complex.

Symmetry type

`'symmetric'`

is not supported.For limitations related to variable-size data, see Variable-Sizing Restrictions for Code Generation of Toolbox Functions (MATLAB Coder).

### Thread-Based Environment

Run code in the background using MATLAB® `backgroundPool`

or accelerate code with Parallel Computing Toolbox™ `ThreadPool`

.

This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.

### GPU Arrays

Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.

Usage notes and limitations:

Unless

`symflag`

is`'symmetric'`

, the output is always complex even if all imaginary parts are zero.

For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).

### Distributed Arrays

Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.

This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).

**Introduced before R2006a**

## Open Example

You have a modified version of this example. Do you want to open this example with your edits?

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

# Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)