fft - fast Fourier transform
fft [ options ... ] input-file
transforms a real-valued time series (from the specified input-file, or from
the standard input if input-file is specified as ‘‘-’’; input-file must be in
text form) into a frequency spectrum (on the standard output). Using appropriate
options, fft can produce polar or rectangular format amplitude spectra,
or power spectra, or it can perform an inverse FFT to transform a polar
or rectangular format amplitude spectrum into a time series. The input
series may be corrected if it has a non-zero mean amplitude or first derivative
(by ‘zero-meaning’ or ‘detrending’ the input series). Output spectra may be
smoothed in several different ways.
By default, the standard output is the
magnitude of the discrete Fourier transform of the input series, normalized
such that the mean of the squares of the inputs is equal to the sum of
the squares of the outputs (i.e., the RMS power determined from the time
series equals the total power determined from the spectrum; this normalization
is correct only if the input series has a mean value of zero).
- Output unnormalized complex FFT (real components in first column, imaginary
components in second column).
- -f frequency
- Show the center frequency for
each bin in the first column. The frequency argument specifies the input
sampling frequency; the center frequencies are given in the same units.
- Print a usage summary.
- Perform inverse FFT; in this case, the standard
input should be in the form generated by fft -c, and the standard output
is a series of samples. No other options may be used with -i.
- Perform inverse
FFT as above, but using input generated by fft -p. No other options may be
used with -I.
- -l n
- Perform up to n-point transforms. fft rounds n up to the
next higher power of two unless n is already a power of two. If the input
series contains fewer than n samples, it is padded with zeros up to the
next higher power of two. Any additional input samples beyond the first
n are not read. Default: n = 16384.
- -n n
- Process the input in overlapping
chunks of n samples and output an averaged spectrum. If used in combination
with -P, the output is the average of the individual squared magnitudes;
otherwise, the output is derived from the averages of the real components
and of the imaginary components taken separately. For best results, n should
be a power of two.
- -N n
- Process the input in overlapping chunks of n samples
and output a spectrum for each chunk. Successive spectra are concatenated
in the output. Only one of -n and -N may be used at a time. For best results,
n should be a power of two.
- Show the phase in radians in the last column.
- Generate a power spectrum (print squared magnitudes).
- -s n
- Smooth the output
by applying an n-point moving average to each bin. This option does not change
the number of bins.
- -S n
- Smooth the output by summing sets of n consecutive
bins. This option reduces the number of bins by a factor of n.
- -w window-type
- Apply the specified window to the input data. window-type may be one of:
‘Bartlett’, ‘Blackman’, ‘Blackman-Harris’, ‘Hamming’, ‘Hanning’, ‘Parzen’, ‘Square’, and
‘Welch’. The ‘Square’ window type is equivalent to using no window at all;
this is also variously known as a rectangular or Dirichlet window.
a constant to each input sample, chosen such that the mean value of the
entire series is zero.
- Set the mean value of the inputs to zero as for
-z, and detrend the series (set its mean first derivative to zero). This
is equivalent to subtracting a best-fit (by least squares) line from the
Because of accumulated round-off errors, the command
fft -p <file1 | fft -I >file2
may not produce an exact copy of file1 in file2, even if the number of
samples is an exact power of 2. Using rectangular form, as in the command
fft -c <file1 | fft -i >file2
produces smaller errors, and is slightly faster than using polar form as
in the first example.
George B. Moody (firstname.lastname@example.org)
Table of Contents
Up: WFDB Applications Guide
Please e-mail your comments and suggestions to email@example.com, or post them to:PhysioNet
MIT Room E25-505A
77 Massachusetts Avenue
Cambridge, MA 02139 USA
Updated 8 March 2019