


Correlations in the multi-taper log spectrum for a single time series - binned point process
Usage:
C=corr_logspepb(data,win,tapers,pad,Fs,fpass)
Input:
Note units have to be consistent. See chronux.m for more information.
data (column vector) -- required
win (duration of the segments) - required.
tapers (precalculated tapers from dpss, or in the form [NW K] e.g [3 5]) -- optional. If not
specified, use [NW K]=[3 5]
pad (padding factor for the FFT) - optional. Defaults to 0.
e.g. For N = 500, if PAD = 0, we pad the FFT
to 512 points; if PAD = 2, we pad the FFT
to 2048 points, etc.
Fs (sampling frequency) - optional. Default 1.
fpass (frequency band to be used in the calculation in the form
[fmin fmax])- optional.
Default all frequencies between 0 and Fs/2
Output:
C (correlations in the log spectrum at two different frequencies)

0001 function C=corr_logspecpb(data,win,tapers,pad,Fs,fpass) 0002 % Correlations in the multi-taper log spectrum for a single time series - binned point process 0003 % 0004 % Usage: 0005 % 0006 % C=corr_logspepb(data,win,tapers,pad,Fs,fpass) 0007 % Input: 0008 % Note units have to be consistent. See chronux.m for more information. 0009 % data (column vector) -- required 0010 % win (duration of the segments) - required. 0011 % tapers (precalculated tapers from dpss, or in the form [NW K] e.g [3 5]) -- optional. If not 0012 % specified, use [NW K]=[3 5] 0013 % pad (padding factor for the FFT) - optional. Defaults to 0. 0014 % e.g. For N = 500, if PAD = 0, we pad the FFT 0015 % to 512 points; if PAD = 2, we pad the FFT 0016 % to 2048 points, etc. 0017 % Fs (sampling frequency) - optional. Default 1. 0018 % fpass (frequency band to be used in the calculation in the form 0019 % [fmin fmax])- optional. 0020 % Default all frequencies between 0 and Fs/2 0021 % Output: 0022 % C (correlations in the log spectrum at two different frequencies) 0023 0024 if nargin < 2; error('Need data and segment information'); end; 0025 if nargin < 3; tapers=[3 5]; end; 0026 if nargin < 4;pad=0;end; 0027 if nargin < 5; Fs=1; end; 0028 if nargin < 6; fpass=[0 Fs/2]; end; 0029 if isempty(tapers); tapers=[3 5]; end; 0030 if isempty(pad);pad=0;end; 0031 if isempty(Fs); Fs=1; end; 0032 if isempty(fpass); fpass=[0 Fs/2]; end; 0033 0034 [S,f]=mtspectrumsegpb(data,win,tapers,pad,Fs,fpass,0); 0035 lS=log(S)'; 0036 [nseg,nf]=size(lS); 0037 lSmean=squeeze(mean(lS)); 0038 lS=lS-lSmean(ones(nseg,1),:); 0039 C=cov(lS); 0040