ifft2 - 2-D inverse fast Fourier transform - MATLAB (original) (raw)
2-D inverse fast Fourier transform
Syntax
Description
X = ifft2([Y](#bvjz37f-Y),[m](#bvjz37f-m),[n](#bvjz37f-n))
truncates Y
or pads Y
with trailing zeros to form an m
-by-n
matrix before computing the inverse transform. X
is also m
-by-n
. If Y
is a multidimensional array, then ifft2
shapes the first two dimensions of Y
according to m
and n
.
X = ifft2(___,[symflag](#bvjz37f-symflag))
specifies the symmetry of Y
in addition to any of the input argument combinations in previous syntaxes. For example,ifft2(Y,'symmetric')
treats Y
as conjugate symmetric.
Examples
You can use the ifft2
function to convert 2-D signals sampled in frequency to signals sampled in time or space. The ifft2
function also allows you to control the size of the transform.
Create a 3-by-3 matrix and compute its Fourier transform.
X = 3×3
8 1 6
3 5 7
4 9 2
Y = 3×3 complex
45.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 13.5000 + 7.7942i 0.0000 - 5.1962i 0.0000 - 0.0000i 0.0000 + 5.1962i 13.5000 - 7.7942i
Take the inverse transform of Y
, which is the same as the original matrix X
, up to round-off error.
ans = 3×3
8.0000 1.0000 6.0000
3.0000 5.0000 7.0000
4.0000 9.0000 2.0000
Pad both dimensions of Y
with trailing zeros so that the transform has size 8-by-8.
Z = ifft2(Y,8,8); size(Z)
For nearly conjugate symmetric matrices, you can compute the inverse Fourier transform faster by specifying the 'symmetric'
option, which also ensures that the output is real.
Compute the 2-D inverse Fourier transform of a nearly conjugate symmetric matrix.
Y = [3+1e-15*i 5; 5 3]; X = ifft2(Y,'symmetric')
Input Arguments
Input array, specified as a matrix or a multidimensional array. If Y
is of type single
, then ifft2
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
Number of inverse transform rows, specified as a positive integer scalar.
Data Types: double
| single
| int8
| int16
| int32
| uint8
| uint16
| uint32
| logical
Number of inverse transform columns, specified as a positive integer scalar.
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,ifft2(Y,'symmetric')
treats Y
as if it were conjugate symmetric by ignoring the second half of its elements (that are in the negative frequency spectrum). For more information on conjugate symmetry, see Algorithms.
More About
This formula defines the discrete inverse Fourier transform X of an _m_-by-n matrix Y:
ωm and ωn are complex roots of unity:
i is the imaginary unit. p runs from 1 to m and q runs from 1 to n.
Algorithms
- The
ifft2
function tests whether the matrixY
is conjugate symmetric. IfY
is conjugate symmetric, then the inverse transform computation is faster and the output is real.
A function g(a,b) is conjugate symmetric if g(a,b)=g*(−a,−b). However, the fast Fourier transform of a 2-D time-domain signal has one half of its spectrum in positive frequencies and the other half in negative frequencies, with the first row and column reserved for the zero frequencies. For this reason, a matrixY
is conjugate symmetric when all of these conditions are true:Y(1,2:end)
is conjugate symmetric, orY(1,2:end) = conj(Y(1,end:-1:2))
Y(2:end,1)
is conjugate symmetric, orY(2:end,1) = conj(Y(end:-1:2,1))
Y(2:end,2:end)
is conjugate centrosymmetric, orY(2:end,2:end) = conj(Y(end:-1:2,end:-1:2))
Extended Capabilities
Usage notes and limitations:
- Symmetry type
'symmetric'
is not supported. - 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). 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).
- 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). 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).
Usage notes and limitations:
- Symmetry type
'symmetric'
is not supported.
The ifft2
function supports GPU array input with these 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).
Version History
Introduced before R2006a