Fast Fourier transform (FFT) of
uses the fast Fourier transform (FFT) algorithm to transform the time-domain
datf = fft(
iddata object data to the frequency
data contains real-valued signals and has constant sample
datf has frequency values equally
distributed from 0 to the Nyquist frequency. The Nyquist frequency is included if
the signal length is even and not included if the length is odd. To preserve the
signal power and noise level, FFTs are normalized by dividing each transform by the
square root of the signal length.
specifies the transformation length
datf = fft(
N. In the default case, the
length of the transformation is determined by the signal length. Including
N forces the FFT transformations to pad with zeros if the
data are shorter than
truncate the signals otherwise. Thus, the number of frequencies in the real signal
N is even or
N is odd.
data contains several experiments,
can be a row vector of corresponding length.
Transform Data from Time to Frequency Domain
Load and plot the time-domain data
z1, which contains 300 samples.
load iddata1 z1; plot(z1)
Transform data to the frequency domain and plot.
datf = fft(z1); plot(datf)
Transform Data by Specifying Transformation Length
Load the data. Use
fft to transform the time-domain data
z1 to the frequency domain, using a transformation length
load iddata1 z1; datf = fft(z1, 100); plot(datf)
Transform Real Data with Negative Frequencies
Load the data. Create
2 frequency-domain objects
'complex' when creating
zf2 to include negative frequencies.
Compare the results.
load iddata1 z1 zf1 = fft(z1,300); zf2 = fft(z1,300,'complex'); h = plot(zf2,zf1); legend('zf2','zf1') opt = getoptions(h); opt.FreqScale = 'linear'; opt.PhaseMatching = 'on'; setoptions(h,opt) xlim([-32 32])
N — Transformation length
scalar integer | row vector of integers
Transformation length, specified as a scalar integer, or for
multiexperiment data, a row vector of integers. By default, each element of
N is equal to the corresponding signal length.
datf — Frequency-domain data
Frequency-domain data, returned as an
fft does not produce the same answer as the base MATLAB®
For real signals, by default,
fftcomputes the FFT for only the positive portion of frequency range. MATLAB
fftcomputes the FFT for the entire frequency range.
fftscales the result by
Nis the data length. MATLAB
fftdoes not apply scaling.
Introduced in R2007a