# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

# dsp.FFT System object

Package: dsp

Discrete Fourier transform

## Description

The `FFT` object computes the discrete Fourier transform (DFT) of an input. The object uses one or more of the following fast Fourier transform (FFT) algorithms depending on the complexity of the input and whether the output is in linear or bit-reversed order:

• Double-signal algorithm

• Half-length algorithm

• Radix-2 decimation-in-time (DIT) algorithm

• Radix-2 decimation-in-frequency (DIF) algorithm

• An algorithm chosen by FFTW ,

To compute the DFT of an input:

1. Define and set up your `FFT` object. See Construction.

2. Call `step` to compute the DFT of the input according to the properties of `dsp.FFT`. The behavior of `step` is specific to each object in the toolbox.

 Note:   Starting in R2016b, instead of using the `step` method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, ```y = step(obj,x)``` and `y = obj(x)` perform equivalent operations.

## Construction

`fft = dsp.FFT` returns a `FFT` object, `H`, that computes the DFT of an N-D array. For column vectors or multidimensional arrays, the `FFT` object computes the DFT along the first dimension. If the input is a row vector, the `FFT` object computes a row of single-sample DFTs and issues a warning.

```H = dsp.FFT('PropertyName',PropertyValue, ...)``` returns a `FFT` object, `H`, with each property set to the specified value.

## Properties

 `FFTImplementation` FFT implementation Specify the implementation used for the FFT as one of `Auto` | `Radix-2` | `FFTW`. When you set this property to `Radix-2`, the FFT length must be a power of two. `BitReversedOutput` Order of output elements relative to input elements Designate order of output channel elements relative to order of input elements. Set this property to `true` to output the frequency indices in bit-reversed order. The default is `false`, which corresponds to a linear ordering of frequency indices. `Normalize` Divide butterfly outputs by two Set this property to `true` if the output of the FFT should be divided by the FFT length. This option is useful when you want the output of the FFT to stay in the same amplitude range as its input. This is particularly useful when working with fixed-point data types. The default value of this property is `false` with no scaling. `FFTLengthSource` Source of FFT length Specify how to determine the FFT length as `Auto` or `Property`. When you set this property to `Auto`, the FFT length equals the number of rows of the input signal. The default is `Auto`. `FFTLength` FFT length Specify the FFT length. This property applies when you set the `FFTLengthSource` property to `Property`. The default is `64`. This property must be a power of two when the input is a fixed-point data type, or when you set the `BitReversedOutput` property to `true`, or when you set the `FFTImplementation` property to `Radix-2`. `WrapInput` Boolean value of wrapping or truncating input Wrap input data when FFT length is shorter than input length. If this property is set to true, modulo-length data wrapping occurs before the FFT operation, given FFT length is shorter than the input length. If this property is set to false, truncation of the input data to the FFT length occurs before the FFT operation. The default is `true`.

## Methods

 step Discrete Fourier transform of input
Common to All System Objects
`clone`

Create System object with same property values

`getNumInputs`

Expected number of inputs to a System object

`getNumOutputs`

Expected number of outputs of a System object

`isLocked`

Check locked states of a System object (logical)

`release`

Allow System object property value changes

## Examples

expand all

Find frequency components of a signal in additive noise.

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent `step` syntax. For example, myObject(x) becomes step(myObject,x).

```Fs = 800; L = 1000; t = (0:L-1)'/Fs; x = sin(2*pi*250*t) + 0.75*cos(2*pi*340*t); y = x + .5*randn(size(x)); % noisy signal ft = dsp.FFT('FFTLengthSource', 'Property', ... 'FFTLength', 1024); Y = ft(y); ```

Plot the single-sided amplitude spectrum

```plot(Fs/2*linspace(0,1,512), 2*abs(Y(1:512)/1024)); title('Single-sided amplitude spectrum of noisy signal y(t)'); xlabel('Frequency (Hz)'); ylabel('|Y(f)|'); ```

## Algorithms

This object implements the algorithm, inputs, and outputs described on the FFT block reference page. The object properties correspond to the block parameters.

## References

[2] Frigo, M. and S. G. Johnson, "FFTW: An Adaptive Software Architecture for the FFT,"Proceedings of the International Conference on Acoustics, Speech, and Signal Processing, Vol. 3, 1998, pp. 1381-1384.

## See Also

### System Objects

#### Introduced in R2012a

Was this topic helpful?

Watch now