.TH FFT 1 "8 August 2002" "WFDB 10.2.7" "WFDB Applications Guide" .SH NAME fft \- fast Fourier transform .SH SYNOPSIS \fBfft\fR [ \fIoptions ...\fR ] \fIinput-file\fR .SH DESCRIPTION .PP \fBfft\fR transforms a real-valued time series (from the specified \fIinput-file\fR, or from the standard input if \fIinput-file\fR is specified as ``-''; \fIinput-file\fR must be in text form) into a frequency spectrum (on the standard output). Using appropriate options, \fBfft\fR 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. .PP 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). .PP \fIOptions\fR are: .TP \fB-c\fR Output unnormalized complex FFT (real components in first column, imaginary components in second column). .TP \fB-f\fR \fIfrequency\fR Show the center frequency for each bin in the first column. The \fIfrequency\fR argument specifies the input sampling frequency; the center frequencies are given in the same units. .TP \fB-h\fR Print a usage summary. .TP \fB-i\fR Perform inverse FFT; in this case, the standard input should be in the form generated by \fBfft -c\fR, and the standard output is a series of samples. No other options may be used with \fB-i\fR. .TP \fB-I\fR Perform inverse FFT as above, but using input generated by \fBfft -p\fR. No other options may be used with \fB-I\fR. .TP \fB-l\fR \fIn\fR Perform up to \fIn\fR-point transforms. \fBfft\fR rounds \fIn\fR up to the next higher power of two unless \fIn\fR is already a power of two. If the input series contains fewer than \fIn\fR samples, it is padded with zeros up to the next higher power of two. Any additional input samples beyond the first \fIn\fR are not read. Default: \fIn\fR = 16384. .TP \fB-n\fR \fIn\fR Process the input in overlapping chunks of \fIn\fR samples and output an averaged spectrum. If used in combination with \fB-P\fR, 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, \fIn\fR should be a power of two. .TP \fB-N\fR \fIn\fR Process the input in overlapping chunks of \fIn\fR samples and output a spectrum for each chunk. Successive spectra are concatenated in the output. Only one of \fB-n\fR and \fB-N\fR may be used at a time. For best results, \fIn\fR should be a power of two. .TP \fB-p\fR Show the phase in radians in the last column. .TP \fB-P\fR Generate a power spectrum (print squared magnitudes). .TP \fB-s\fR \fIn\fR Smooth the output by applying an \fIn\fR-point moving average to each bin. This option does not change the number of bins. .TP \fB-S\fR \fIn\fR Smooth the output by summing sets of \fIn\fR consecutive bins. This option reduces the number of bins by a factor of \fIn\fR. .TP \fB-w\fR \fIwindow-type\fR Apply the specified window to the input data. \fIwindow-type\fR 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. .TP \fB-z\fR Add a constant to each input sample, chosen such that the mean value of the entire series is zero. .TP \fB-Z\fR Set the mean value of the inputs to zero as for \fB-z\fR, 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 input data. .SH BUGS .PP Because of accumulated round-off errors, the command .br \fBfft -p <\fR\fIfile1\fR\fB | fft -I >\fR\fIfile2\fR .br may not produce an exact copy of \fIfile1\fR in \fIfile2\fR, even if the number of samples is an exact power of 2. Using rectangular form, as in the command .br \fBfft -c <\fR\fIfile1\fR\fB | fft -i >\fR\fIfile2\fR .br produces smaller errors, and is slightly faster than using polar form as in the first example. .SH SEE ALSO .PP \fBcoherence\fR(1), \fBhrfft\fR(1), \fBlomb\fR(1), \fBmemse\fR(1) .SH AUTHOR George B. Moody (george@mit.edu) .SH SOURCE http://www.physionet.org/physiotools/wfdb/psd/fft.c