FFT VI

Owning Palette: Transforms VIs

Requires: Full Development System

Computes the fast Fourier transform (FFT) of the input sequence X. Wire data to the X input to determine the polymorphic instance to use or manually select the instance.

Details  Example

Use the pull-down menu to select an instance of this VI.

 Add to the block diagram  Find on the palette

Real FFT

X is a real vector.
shift? specifies whether the DC component is at the center of FFT {X}. The default is FALSE.
FFT size is the length of the FFT you want to perform. If FFT size is greater than the number of elements in X, this VI 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 VI 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 VI uses the length of X as the FFT size.
FFT {X} is the FFT of X.
error returns any error or warning from the VI. You can wire error to the Error Cluster From Error Code VI to convert the error code or warning into an error cluster.

Complex FFT

X is the complex valued input sequence.
shift? specifies whether the DC component is at the center of FFT {X}. The default is FALSE.
FFT size is the length of the FFT you want to perform. If FFT size is greater than the number of elements in X, this VI 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 VI 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 VI uses the length of X as the FFT size.
FFT {X} is the FFT of X.
error returns any error or warning from the VI. You can wire error to the Error Cluster From Error Code VI to convert the error code or warning into an error cluster.

2D Real FFT

X is the real input sequence.
shift? specifies whether the DC component is at the center of FFT {X}. The default is FALSE.
m specifies the number of rows of the 2D FFT. This VI truncates or zero-pads X to an m-by-n array before performing the FFT.
n specifies the number of columns of the 2D FFT. This VI truncates or zero-pads X to an m-by-n array before performing the FFT.
FFT {X} is the 2D FFT of X. If the input signal is in volts (V), FFT {X} has units of volts. If the input signal is not in volts, FFT {X} has units of the input signal unit. This VI returns the phase in radians.
error returns any error or warning from the VI. You can wire error to the Error Cluster From Error Code VI to convert the error code or warning into an error cluster.

2D Complex FFT

X is the complex valued input sequence.
shift? specifies whether the DC component is at the center of FFT {X}. The default is FALSE.
m specifies the number of rows of the 2D FFT. This VI truncates or zero-pads X to an m-by-n array before performing the FFT.
n specifies the number of columns of the 2D FFT. This VI truncates or zero-pads X to an m-by-n array before performing the FFT.
FFT {X} is the 2D FFT of X. If the input signal is in volts (V), FFT {X} has units of volts. If the input signal is not in volts, FFT {X} has units of the input signal unit. This VI returns the phase in radians.
error returns any error or warning from the VI. You can wire error to the Error Cluster From Error Code VI to convert the error code or warning into an error cluster.

FFT Details

1D FFT

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

for n = 0, 1, 2, …, 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:

where fs is the sampling frequency.

The following table illustrates the pattern of the elements of FFT {X} for various FFT size and shift values, where Y is FFT {X} and n is the FFT size:

n is even (k = n/2) n is odd (k = (n-1)/2)
shift = FALSE
(default)
Array
Element
Corresponding
Frequency
Array
Element
Corresponding
Frequency
Y0 DC component Y0 DC component
Y1 f Y1 f
Y2 2f Y2 2f
Y3 3f Y3 3f
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
Yk–2 (k–2)f Yk–2 (k–2)f
Yk–1 (k–1)f Yk–1 (k–1)f
Yk Nyquist Frequency Yk kf
Yk+1 –(k–1)f Yk+1 kf
Yk+2 –(k–2)f Yk+2 –(k–1)f
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
Yn–3 –3f Yn–3 –3f
Yn–2 –2f Yn–2 –2f
Yn–1 f Yn–1 f
shift = TRUE Array
Element
Corresponding
Frequency
Array
Element
Corresponding
Frequency
Y0 –(Nyquist Frequency) Y0 kf
Y1 –(k–1)f Y1 –(k–1)f
Y2 –(k–2)f Y2 –(k–2)f
Y3 –(k–3)f Y3 –(k–3)f
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
Yk–2 –2f Yk–2 –2f
Yk–1 f Yk–1 f
Yk DC component Yk DC component
Yk+1 f Yk+1 f
Yk+2 2f Yk+2 2f
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
 .
Yn–3 (k–3)f Yn–3 (k–2)f
Yn–2 (k–2)f Yn–2 (k–1)f
Yn–1 (k–1)f Yn–1 kf

2D FFT

For 2D signals, the FFT VI computes the discrete Fourier transform (DFT) of the input matrix. This VI 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:

for u = 0, 1, …, M–1, v=0, 1, …, N–1

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

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

2D input signals FFT without shift FFT with shift

Related Information

Output Units for FFT-Based Vis

Example

Refer to the FFT and Power Spectrum Units VI in the labview\examples\Signal Processing\Transforms directory for an example of using the FFT VI.

 Open example  Find related examples