Discrete Fourier transform
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:
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:
Define and set up your
step to compute the DFT of the input according
to the properties of
dsp.FFT. The behavior of
specific to each object in the toolbox.
Starting in R2016b, instead of using the
fft = dsp.FFT returns
H, that computes the
DFT of an N-D array. For column vectors or multidimensional
FFT object computes the DFT along the
first dimension. If the input is a row vector, the
computes a row of single-sample DFTs and issues a warning.
H = dsp.FFT(' returns a
with each property set to the specified value.
Specify the implementation used for the FFT as one of
Order of output elements relative to input elements
Designate order of output channel elements relative to order
of input elements. Set this property to
Divide butterfly outputs by two
Set this property to
The default value of this property is
Source of FFT length
Specify how to determine the FFT length as
Specify the FFT length. This property applies when you set the
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
|step||Discrete Fourier transform of input|
|Common to All System Objects|
Create System object with same property values
Expected number of inputs to a System object
Expected number of outputs of a System object
Check locked states of a System object (logical)
Allow System object property value changes
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)|');
This object implements the algorithm, inputs, and outputs described on the FFT block reference page. The object properties correspond to the block parameters.
 FFTW (
 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.
Usage notes and limitations:
System Objects in MATLAB Code Generation (MATLAB Coder).
When the following conditions apply, the executable
generated from this System object relies on prebuilt dynamic library
.dll files) included with MATLAB®:
FFTImplementation is set to
FFTImplementation is set to
not a power of two.
to package the code generated from this System object and all
the relevant files in a compressed zip file. Using this zip file,
you can relocate, unpack, and rebuild your project in another development
environment where MATLAB is not installed. For more details,
see How To Run a Generated Executable Outside MATLAB.
When the FFT length is a power of two, you can generate standalone C and C++ code from this System object.