Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

FFT (Not in Base Package)

LabVIEW 8.2 Help
August 2006

NI Part Number:
371361B-01

»View Product Info

Computes the Fast Fourier Transform (FFT) of the input sequence X. The data type you wire to the X input determines the polymorphic instance to use. Details  Example

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

Real FFT

X is the real input sequence.
shift? specifies whether this VI shifts the DC component to 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 zeroes 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 the number of elements in FFT size. If FFT size is less than or equal to zero, this VI uses the length of X as the FFT size.
FFT {X} is the 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.

Complex FFT

X is the complex valued input sequence.
shift? specifies whether this VI shifts the DC component to 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 zeroes 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 the number of elements in FFT size. If FFT size is less than or equal to zero, this VI uses the length of X as the FFT size.
FFT {X} is the 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 Real FFT

X is the real input sequence.
shift? specifies whether this VI shifts the DC component to 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 this VI shifts the DC component to 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.

If FFT size is greater than the length of the input sequence X, LabVIEW pads the sequence with trailing zeroes to FFT size. If FFT size is less than the length of X, LabVIEW truncates the sequence.

The shift? input specifies whether this VI shifts the DC component of the FFT result to the center of FFT {X}. LabVIEW shifts the DC component if shift? is TRUE. 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.

Similar to the 1D FFT, for a given FFT size, (p, q), this VI truncates or zero pads the input matrix if the matrix size is not (p, q).

The shift? input specifies whether this VI shifts the DC component of the FFT result to the center of FFT {X}. LabVIEW shifts the DC component if shift? is TRUE. The illustration below shows the effect of shift? on the 2D FFT result:

2D input signals FFT without shift FFT with shift

Example

Refer to the FFT and Power Spectrum Units VI in the labview\examples\measure\maxmpl.llb for an example of using the FFT VI.

 


Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit