From 12:00 PM - 4:00 PM CST on Thursday, October 18, ni.com will be undergoing system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

# FFT (G Dataflow)

Computes the fast Fourier transform (FFT) of a sequence.

## x

A real vector.

This input accepts the following data types:

• 1D array of double-precision, floating-point numbers
• 1D array of complex double-precision, floating-point numbers
• 2D array of double-precision, floating-point numbers
• 2D array of complex double-precision, floating-point numbers

## FFT size

The length of the FFT you want to perform. If FFT size is greater than the number of elements in x, this node adds zeros to the end of x to match the size of FFT size. If FFT size is less than the number of elements in x, this node uses only the first n elements in x to perform the FFT, where n is FFT size. If FFT size is less than or equal to 0, this node uses the length of x as the FFT size.

## shift?

A Boolean that determines whether the DC component is at the center of the FFT of the input sequence.

 True The DC component is at the center of the FFT{x}. False The DC component is not at the center of the FFT{x}.

How This Input Affects 1D FFT

The following table illustrates the pattern of the elements of FFT{x} with various length of the FFT, when shift? is False. Y is FFT{x} and n is the length of the FFT:

n is even (k = n/2) n is odd (k = (n-1)/2)
Array Element Corresponding Frequency Array Element Corresponding Frequency
Y0 DC component Y0 DC component
Y1 $\mathrm{\Delta }f$ Y1 $\mathrm{\Delta }f$
Y2 $2\mathrm{\Delta }f$ Y2 $2\mathrm{\Delta }f$
Y3 $3\mathrm{\Delta }f$ Y3 $3\mathrm{\Delta }f$
$\begin{array}{c}\cdot \\ \cdot \\ \cdot \end{array}$ $\begin{array}{c}\cdot \\ \cdot \\ \cdot \end{array}$ $\begin{array}{c}\cdot \\ \cdot \\ \cdot \end{array}$ $\begin{array}{c}\cdot \\ \cdot \\ \cdot \end{array}$
Yk-2 $\left(k-2\right)\mathrm{\Delta }f$ Yk-2 $\left(k-2\right)\mathrm{\Delta }f$
Yk-1 $\left(k-1\right)\mathrm{\Delta }f$ Yk-1 $\left(k-1\right)\mathrm{\Delta }f$
Yk Nyquist Frequency Yk $k\mathrm{\Delta }f$
Yk+1 $-\left(k-1\right)\mathrm{\Delta }f$ Yk+1 $-k\mathrm{\Delta }f$
Yk+2 $-\left(k-2\right)\mathrm{\Delta }f$ Yk+2 $-\left(k-1\right)\mathrm{\Delta }f$
$\begin{array}{c}\cdot \\ \cdot \\ \cdot \end{array}$ $\begin{array}{c}\cdot \\ \cdot \\ \cdot \end{array}$ $\begin{array}{c}\cdot \\ \cdot \\ \cdot \end{array}$ $\begin{array}{c}\cdot \\ \cdot \\ \cdot \end{array}$
Yn-3 $-3\mathrm{\Delta }f$ Yn-3 $-3\mathrm{\Delta }f$
Yn-2 $-2\mathrm{\Delta }f$ Yn-2 $-2\mathrm{\Delta }f$
Yn-1 $-\mathrm{\Delta }f$ Yn-1 $-\mathrm{\Delta }f$

The following table illustrates the pattern of the elements of FFT{x} with various length of the FFT, when shift? is True. Y is FFT{x} and n is the length of the FFT:

n is even (k = n/2) n is odd (k = (n-1)/2)
Array Element Corresponding Frequency Array Element Corresponding Frequency
Y0 -(Nyquist Frequency) Y0 $-k\mathrm{\Delta }f$
Y1 $-\left(k-1\right)\mathrm{\Delta }f$ Y1 $-\left(k-1\right)\mathrm{\Delta }f$
Y2 $-\left(k-2\right)\mathrm{\Delta }f$ Y2 $-\left(k-2\right)\mathrm{\Delta }f$
Y3 $-\left(k-3\right)\mathrm{\Delta }f$ Y3 $-\left(k-3\right)\mathrm{\Delta }f$
$\begin{array}{c}\cdot \\ \cdot \\ \cdot \end{array}$ $\begin{array}{c}\cdot \\ \cdot \\ \cdot \end{array}$ $\begin{array}{c}\cdot \\ \cdot \\ \cdot \end{array}$ $\begin{array}{c}\cdot \\ \cdot \\ \cdot \end{array}$
Yk-2 $-2\mathrm{\Delta }f$ Yk-2 $-2\mathrm{\Delta }f$
Yk-1 $-\mathrm{\Delta }f$ Yk-1 $-\mathrm{\Delta }f$
Yk DC component Yk DC component
Yk+1 $\mathrm{\Delta }f$ Yk+1 $\mathrm{\Delta }f$
Yk+2 $2\mathrm{\Delta }f$ Yk+2 $2\mathrm{\Delta }f$
$\begin{array}{c}\cdot \\ \cdot \\ \cdot \end{array}$ $\begin{array}{c}\cdot \\ \cdot \\ \cdot \end{array}$ $\begin{array}{c}\cdot \\ \cdot \\ \cdot \end{array}$ $\begin{array}{c}\cdot \\ \cdot \\ \cdot \end{array}$
Yn-3 $\left(k-3\right)\mathrm{\Delta }f$ Yn-3 $\left(k-2\right)\mathrm{\Delta }f$
Yn-2 $\left(k-2\right)\mathrm{\Delta }f$ Yn-2 $\left(k-1\right)\mathrm{\Delta }f$
Yn-1 $\left(k-1\right)\mathrm{\Delta }f$ Yn-1 $k\mathrm{\Delta }f$

How This Input Affects 2D FFT

The illustration below shows the effect of shift? on the 2D FFT result:

2D input signals FFT without shift FFT with shift

Default: False

## error in

Error conditions that occur before this node runs. The node responds to this input according to standard error behavior.

Default: No error

## FFT{x}

FFT of the input signal.

This output can be a 1D or 2D array of complex double-precision, floating-point numbers.

## error out

Error information. The node produces this output according to standard error behavior.

## Algorithm Definition for 1D FFT

For 1D signals, this node computes the discrete Fourier transform (DFT) of the input sequence with a fast Fourier transform algorithm. The 1D DFT is defined as:

${Y}_{k}=\underset{n=0}{\overset{N-1}{\sum }}{x}_{n}{e}^{-j2\pi kn/N}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\mathrm{for}\text{\hspace{0.17em}}n=0,\text{\hspace{0.17em}}1,\text{\hspace{0.17em}}2,\text{\hspace{0.17em}}...,\text{\hspace{0.17em}}N-1$

where x is the input sequence, N is the number of elements of x, and Y is the transform result.

The frequency resolution, or the frequency spacing between the components of Y, is:

$\mathrm{\Delta }f=\frac{{f}_{s}}{N}$

where fs is the sampling frequency.

## Algorithm Definition for 2D FFT

For 2D signals, this node computes the discrete Fourier transform (DFT) of the input matrix. This node performs a 1D FFT on the rows of the input matrix and then performs a 1D FFT on the columns of the output of the preceding step. The DFT of an M-by-N matrix is defined as:

$Y\left(u,v\right)=\underset{m=0}{\overset{M-1}{\sum }}\underset{n=0}{\overset{N-1}{\sum }}x\left(m,n\right){e}^{-j2\pi mu/M}{e}^{-j2\pi nv/N}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\mathrm{for}\text{\hspace{0.17em}}\text{\hspace{0.17em}}u=0,\text{\hspace{0.17em}}1,\text{\hspace{0.17em}}...,\text{\hspace{0.17em}}M-1,\text{\hspace{0.17em}}v=0,\text{\hspace{0.17em}}1,\text{\hspace{0.17em}}...,\text{\hspace{0.17em}}N-1$

where x is the input matrix and Y is the transform result.

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported