Documentation

FFT2

2-D fast Fourier transform

Description

example

y = fft2(X)returns thetwo-dimensional Fourier transformof a matrix using a fast Fourier transform algorithm, which is equivalent to computingFFT(fft(X).').'. IfX是一个多维数组,然后FFT2takes the 2-D transform of each dimension higher than 2. The outputYis the same size asX.

example

y = fft2(X,m,n)truncatesXor padsXwith trailing zeros to form anm-by-nmatrix before computing the transform.Yism-by-n. IfX是一个多维数组,然后FFT2shapes the first two dimensions ofXaccording tomn.

Examples

collapse all

The 2-D Fourier transform is useful for processing 2-D signals and other 2-D data such as images.

使用重复块创建和绘制2-D数据。

P = peaks(20); X = repmat(P,[5 10]); imagesc(X)

Compute the 2-D Fourier transform of the data. Shift the zero-frequency component to the center of the output, and plot the resulting 100-by-200 matrix, which is the same size asX.

y = fft2(X); imagesc(abs(fftshift(Y)))

PadXwith zeros to compute a 128-by-256 transform.

y = fft2(x,2^nextPow2(100),2^nextPow2(200));imagesc(abs(fftshift(y)));

Input Arguments

collapse all

Input array, specified as a matrix or a multidimensional array. IfXis of typesingle, thenFFT2natively computes in single precision, andYis also of typesingle. Otherwise,Yis returned as typedouble.

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

变换行的数量, specified as a positive integer scalar.

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

Number of transform columns, specified as a positive integer scalar.

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

More About

collapse all

2-D Fourier Transform

This formula defines the discrete Fourier transformYof anm-by-nmatrixX:

ωmωnare complex roots of unity:

iis the imaginary unit.pjare indices that run from 0 tom–1, andqkare indices that run from 0 ton–1. This formula shifts the indices forXYby 1 to reflect matrix indices in MATLAB®.

Extended Capabilities

GPU Code Generation
使用GPU CODER™为NVIDIA®GPU生成CUDA®代码。

See Also

|||

Introduced before R2006a