CROSSF Returns estimates and plot of event-related coherence (ERC) changes between data from two input channels. The lower panel gives the coherent phase difference between the processes. In this panel, for Ex. -90 degrees (blue) means xdata leads ydata by a quarter cycle. 90 degrees (orange) means ydata leads xdata by a quarter cycle. Click on each subplot to view separately and zoom in/out.

Function description: Uses EITHER fixed-window, zero-padded FFTs (faster) OR constant-Q
0-padded DFTs (better sensitivity), both Hanning-tapered. Output
frequency spacing is the lowest frequency (srate/winsize) divided
by the padratio.
If 'alpha' is given, then bootstrap statistics are
computed (from a distribution of 200 (g.naccu) surrogate baseline
data epochs) for the baseline epoch, and non-significant features
of the output plots are zeroed (e.g., plotted in green). Baseline
epoch is all windows with center times < 'baseline' or the whole
epoch if 'baseboot' is set to 1.

Usage: >> [coh,mcoh,timesout,freqsout,cohboot,cohangles] = crossf(xdata,ydata, frames,tlimits,titl, srate,cycles,winsize,timesout, padratio,maxfreq,alpha,verts);

Inputs:
xdata   
first single-channel (1,frames*nepochs) data {none}
ydata   
second single-channel (1,frames*nepochs) data {none}
frames   
frames per epoch {768}
tlimits   
[mintime maxtime] (ms) epoch time limits {[-1000 2000]}
srate   
data sampling rate (Hz) {256}
cycles   
>0 -> Number of cycles in each analysis wavelet =0 -> Use FFTs (with constant window length) {0}

Optional crossf type:
'type'   
['coher'|'phasecoher'], compute either the coherence ('coher') or the phase coherence ('phasecoher') also known as the phase coupling factor of the two data inputs. Default is 'phasecoher' { 'phasecoher' }.

Optional Detrend:
'detret'   
['on'|'off'], Detrend data in time. {'off'}
'detrep'   
['on'|'off'], Detrend data across epochs (trials) {'off'}

Optional FFT/DFT:
'winsize'   
If cycles==0: data subwindow length (fastest, 2^n0: *longest* window length to use. This determines the lowest output frequency {~frames/8}
'timesout'   
Number of output times (int
'padratio'   
FFT-length/winframes (2^k) {2} Multiplies the number of output frequencies by dividing their spacing. When cycles==0, frequency spacing is (low freq/padratio).
'maxfreq'   
Maximum frequency (Hz) to plot (& output if cycles>0) {50} If cycles==0, all FFT frequencies are output.
'baseline'   
ERSP baseline end time (ms). {0}
'powbase'   
Baseline spectrum to log-subtract. {def|NaN->from data}

Optional Bootstrap:
'alpha'   
If non-0, compute Two-tailed bootstrap significance prob. level. Show non-signif output values as green. {0}
'naccu'   
Number of bootstrap replications to compute {200}
'baseboot'   
Bootstrap baseline subtract (0=same as 'baseline'; 1=whole epoch) {0}
'topovec'   
Scalp topography (map) to plot {[]}
'elocs'   
Electrode location file for scalp map {no default} File should be ascii in format of >> topoplot example

Optional Plot:
'plotamps'   
['on'|'off'], Plot amplitude {'on'}
'plotphase'   
['on'|'off'], Plot phase {'off'}
'title'   
Optional figure title {none}
'marktimes'   
Times to mark with a dotted vertical line{def|NaN->none}
'linewidth'   
Line width for marktimes traces (thick=2, thin=1) {2}
'cmax'   
maximum amplitude for color scale { use data limits }
'angleunit'   
angle plotting units 'ms' for milliseconds or 'deg' for degree of angle { 'deg' }
'pboot'   
Bootstrap power limits (from timefm data}
'rboot'   
Bootstrap ITC limits (from timef) {def|NaN->from data}
'axesfont'   
Font size for the axes {10}
'titlefont'   
Font size for the title {8}

Outputs:
coh   
between-channel coherency changes (nfreqs,timesout)
mcoh   
vector of mean baseline coherence at each frequency
timesout   
vector of output times (subwindow centers) in ms.
freqsout   
vector of frequency bin centers in Hz.
cohboot   
[2,nfreqs] matrix of [lower;upper] coh significance diffs.
cohangle   
coherency angles (nfreqs,timesout)

Note: when cycles==0, nfreqs is total number of FFT frequencies.

Authors: Sigurd Enghoff, Scott Makeig & Arnaud Delorme
SCCN/INC/UCSD, La Jolla, 1998-2002

See also: timef

See the matlab file crossf.m (may require other functions)

Back to functions