fft2

Two-dimensional discrete Fourier transform.

Category: Mathematics > Fourier Analysis and Filtering

Syntax

Y = fft2(X)

Transforms along the first two dimensions.

Y = fft2(X, m, n)

Zero-pads or truncates X to m rows and n columns first.

Description

fft2(X) is the same as fft(fft(X).').': a one-dimensional transform down every column followed by one along every row. It is the basis for frequency-domain image filtering and for fast 2-D convolution.

For N-D input, each page (the slices over dimensions 3 and up) is transformed independently. Use fftshift to move the zero-frequency term to the center for display.

Input arguments

X
Numeric matrix or N-D array.
m, n
Number of rows and columns of the transform.

Output arguments

Y
Two-dimensional spectrum. Y(1,1) is the sum of all elements.

Example

Small matrix and padding

fft2([1 2; 3 4])
size(fft2([1 2; 3 4], 3, 3))
Output
ans = 2×2

    10    -2
    -4     0
ans = 1×2

     3     3

See also

ifft2 fft fftn fftshift conv2