Next: DFA(1) Up: WFDB Applications Guide Previous: CALSIG(1)On This Page


coherence - estimate coherence and cross-spectrum of two time series


coherence -i file [ options ... ]


coherence estimates the coherence and cross-spectrum of a pair of real-valued time series; as a byproduct of its calculation of coherence, it also estimates the autospectra of each of its input time series. The file argument specifies the name of a text file containing the samples of the series in two columns. The standard output contains five columns of numbers (optionally preceded by column headings), which are frequency (Hz), coherence, cross-spectral power (dB), autospectral power (dB) of the first time series, and autospectral power (dB) of the second time series.

This program is based on a Fortran program by C.R. Arnold, G.C. Carter, and J.F. Ferrie, as described in ‘A coherence and cross-spectral estimation program’, by G.C. Carter and J.F. Ferrie, in Programs for Digital Signal Processing, edited by the Digital Signal Processing Committee of the IEEE ASSP Society (New York: IEEE Press, 1979). The functions fft842() and its auxiliary functions r2tx(), r4tx(), and r8tx(), are based on Fortran subroutines by G.D. Bergland and M.T. Dolan, as described by them in ‘Fast Fourier transform algorithms’, also included in Programs for Digital Signal Processing.

Options are:

-f frequency
Specify the sampling frequency in Hz (default: 250).
-n n
Process the input in overlapping chunks of n samples (default: 1024). For best results, n should be a power of two.
Print column headings.
-x sx sy
Specify multiplicative scale factors for the two time series (defaults: 1). A reasonable choice is to use the reciprocals of the standard deviations of the respective time series if these differ significantly.

Note that the scale factors generally have little or no visible effect on the coherence or on the shape of the spectra. The choice of chunk size (using the -n option) will have a significant effect; some experimentation may be needed to determine an appropriate chunk size in each case.

See Also



George B. Moody (


Table of Contents

Up: WFDB Applications Guide

Please e-mail your comments and suggestions to, or post them to:

MIT Room E25-505A
77 Massachusetts Avenue
Cambridge, MA 02139 USA

Updated 28 May 2015