| SPECTOPO | Plot the mean log spectrum of a set of data epochs at all channels as a bundle of traces. At specified frequencies, plot the relative topographic distribution of power. If available, uses pwelch() from the Matlab signal processing toolbox, else the EEGLAB spec function. Plots the mean spectrum for all of the supplied data, not just the pre-stimulus baseline. |
| Usage: | >> spectopo(data, frames, srate); >> [spectra,freqs,speccomp,contrib,specstd] = spectopo(data, frames, srate, 'key1','val1', 'key2','val2' ...); |
| Inputs: | |
data |
If 2-D (nchans,time_points); % may be a continuous single epoch, else a set of concatenated data epochs, else a 3-D set of data epochs (nchans,frames,epochs) |
frames |
frames per epoch {default|0 -> data length} |
srate |
sampling rate per channel (Hz) |
| Optional 'keyword',[argument] input pairs: | |
'freq' |
[float vector (Hz)] vector of frequencies at which to plot power scalp maps, or else a single frequency at which to plot component contributions at a single channel (see also 'plotchan'). |
'chanlocs' |
[electrode locations filename or EEG.chanlocs structure]. For format, see >> topoplot example |
'limits' |
[xmin xmax ymin ymax cmin cmax] axis limits. Sets x, y, and color axis limits. May omit final values or use NaNs. Ex: [0 60 NaN NaN -10 10], [0 60], ... Default color limits are symmetric around 0 and are different for each scalp map {default|all NaN's: from the data limits} |
'title' |
[quoted string] plot title {default: none} |
'freqfac' |
[integer] ntimes to oversample -> frequency resolution {default: 2} |
'nfft' |
[integer] length to zero-pad data to. Overwrites 'freqfac' above. |
'winsize' |
[integer] window size in data points {default: from data} |
'overlap' |
[integer] window overlap in data points {default: 0} |
'percent' |
[float 0 to 100] percent of the data to sample for computing the spectra. Values < 100 speed up the computation. {default: 100}. |
| 'freqrange' = [min max] frequency range to plot. Changes x-axis limits {default: | 1 Hz for the min and Nyquist (srate/2) for the max. If specified power distribution maps are plotted, the highest mapped frequency determines the max freq}. |
'reref' |
['averef'|'off'] convert data to average reference {default: 'off'} |
'mapnorm' |
[float vector] If 'data' contain the activity of an independant component, this parameter should contain its scalp map. In this case the spectrum amplitude will be scaled to component RMS scalp power. Useful for comparing component strengths {default: none} |
'boundaries' |
data point indices of discontinuities in the signal {default: none} |
'plot' |
['on'|'off'] 'off' -> disable plotting {default: 'on'} |
'rmdc' |
['on'|'off'] 'on' -> remove DC {default: 'off'} |
'plotmean' |
['on'|'off'] 'on' -> plot the mean channel spectrum {default: 'off'} |
| Optionally plot component contributions: | |
'weights' |
ICA unmixing matrix. Here, 'freq' (above) must be a single frequency. ICA maps of the N ('nicamaps') components that account for the most power at the selected frequency ('freq') are plotted along with the spectra of the selected channel ('plotchan') and components ('icacomps'). |
'plotchan' |
[integer] channel at which to compute independent conmponent contributions at the selected frequency ('freq'). If 0, plot RMS power at all channels. {defatul|[] -> channel with highest power at specified 'freq' (above)). |
'mapchans' |
[int vector] channels to plot in topoplots {default: all} 'mapframes'= [int vector] frames to plot {default: all} |
'nicamaps' |
[integer] number of ICA component maps to plot {default: 4}. |
'icacomps' |
[integer array] indices of ICA component spectra to plot ([] -> all). |
'icamode' |
['normal'|'sub'] in 'sub' mode, instead of computing the spectra of individual ICA components, the function computes the spectrum of the data minus their contributions {default: 'normal'} |
'icamaps' |
[integer array] force plotting of selected ICA compoment maps {default: [] = the 'nicamaps' largest contributing components}. |
'icawinv' |
[float array] inverse component weight or mixing matrix. Normally, this is computed by inverting the ICA unmixing matrix 'weights' (above). However, if any components were removed from the supplied 'weights'mapchans then the component maps will not be correctly drawn and the 'icawinv' matrix should be supplied here {default: from component 'weights'} |
'memory' |
['low'|'high'] a 'low' setting will use less memory for computing component activities, will take longer {default: 'high'} |
| Replotting options: | |
'specdata' |
[freq x chan array ] spectral data |
'freqdata' |
[freq] array of frequencies |
| Topoplot options: | other 'key','val' options are propagated to topoplot() for map display (See >> help topoplot) |
| Outputs: | |
spectra |
(nchans,nfreqs) power spectra (mean power over epochs), in dB |
freqs |
frequencies of spectra (Hz) |
speccomp |
component spectra (ncomps,nfreqs). Warning, only the function only computes the spectrum of the components given as input using the 'icacomps' parameter. Other component spectrum are filled with 0. |
contrib |
contribution of each component (if 'icamode' is 'normal', relative variance, if 'icamode' is 'sub', percent variance accounted for) |
specstd |
spectrum standard deviation in dB |
| Notes: | The original input format is still functional for backward compatibility. psd() has been replaced by pwelch() (see Matlab note 24750 on their web site) |
| Authors: | Scott Makeig, Arnaud Delorme & Marissa Westerfield, SCCN/INC/UCSD, La Jolla, 3/01 |
| See also: | timtopo(), envtopo, tftopo(), topoplot() |