Home > chronux_1_15 > continuous > mtspecgramtrigc.m

mtspecgramtrigc

PURPOSE ^

Multi-taper event triggered time-frequency spectrum - continuous process

SYNOPSIS ^

function [S,t,f,Serr]=mtspecgramtrigc(data,E,win,movingwin,params)

DESCRIPTION ^

 Multi-taper event triggered time-frequency spectrum - continuous process

 Usage:

 [S,t,f,Serr]=mtspecgramtrigc(data,E,win,movingwin,params)
 Input: 
 Note units have to be consistent. Thus, if movingwin is in seconds, Fs
 has to be in Hz. see chronux.m for more information.
       data        (single channel data) -- required
       E           (event times) -- required
       win         (in the form [winl winr] i.e window around each event)
                                                 required
       movingwin         (in the form [window winstep] i.e length of moving
                                                 window and step size) -
                                                 required
                                                 Note that units for the windows have
                                                 to be consistent with
                                                 units of Fs
       params: structure with fields tapers, pad, Fs, fpass, err, trialave
       - optional
           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
           err  (error calculation [1 p] - Theoretical error bars; [2 p] - Jackknife error bars
                                   [0 p] or 0 - no error bars) - optional. Default 0.
           trialave (average over events when 1, don't average when 0) - optional. Default 0
 Output:
       S       (triggered spectrum in form time x frequency x events for trialave=0; or in the form time x frequency trialave=1)
       t       (times)
       f       (frequencies)
       Serr    (error bars) only for err(1)>=1

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [S,t,f,Serr]=mtspecgramtrigc(data,E,win,movingwin,params)
0002 % Multi-taper event triggered time-frequency spectrum - continuous process
0003 %
0004 % Usage:
0005 %
0006 % [S,t,f,Serr]=mtspecgramtrigc(data,E,win,movingwin,params)
0007 % Input:
0008 % Note units have to be consistent. Thus, if movingwin is in seconds, Fs
0009 % has to be in Hz. see chronux.m for more information.
0010 %       data        (single channel data) -- required
0011 %       E           (event times) -- required
0012 %       win         (in the form [winl winr] i.e window around each event)
0013 %                                                 required
0014 %       movingwin         (in the form [window winstep] i.e length of moving
0015 %                                                 window and step size) -
0016 %                                                 required
0017 %                                                 Note that units for the windows have
0018 %                                                 to be consistent with
0019 %                                                 units of Fs
0020 %       params: structure with fields tapers, pad, Fs, fpass, err, trialave
0021 %       - optional
0022 %           tapers (precalculated tapers from dpss, or in the form [NW K] e.g [3 5]) -- optional. If not
0023 %                                                 specified, use [NW K]=[3 5]
0024 %            pad            (padding factor for the FFT) - optional. Defaults to 0.
0025 %                       e.g. For N = 500, if PAD = 0, we pad the FFT
0026 %                       to 512 points; if PAD = 2, we pad the FFT
0027 %                       to 2048 points, etc.
0028 %           Fs   (sampling frequency) - optional. Default 1.
0029 %           fpass    (frequency band to be used in the calculation in the form
0030 %                                   [fmin fmax])- optional.
0031 %                                   Default all frequencies between 0 and Fs/2
0032 %           err  (error calculation [1 p] - Theoretical error bars; [2 p] - Jackknife error bars
0033 %                                   [0 p] or 0 - no error bars) - optional. Default 0.
0034 %           trialave (average over events when 1, don't average when 0) - optional. Default 0
0035 % Output:
0036 %       S       (triggered spectrum in form time x frequency x events for trialave=0; or in the form time x frequency trialave=1)
0037 %       t       (times)
0038 %       f       (frequencies)
0039 %       Serr    (error bars) only for err(1)>=1
0040 
0041 if nargin < 4; error('Need data, events and parameters for the windows'); end;
0042 if nargin < 5; params=[]; end;
0043 [tapers,pad,Fs,fpass,err,trialave,params]=getparams(params);
0044 clear tapers pad fpass trialave
0045 if nargout > 3 && err(1)==0; 
0046 %   Cannot compute error bars with err(1)=0. change params and run again.
0047     error('When Serr is desired, err(1) has to be non-zero.');
0048 end;
0049 data=change_row_to_column(data);
0050 data=createdatamatc(data,E,Fs,win); 
0051 if nargout==4;
0052     [S,t,f,Serr]=mtspecgramc(data,movingwin,params);
0053 else
0054     [S,t,f]=mtspecgramc(data,movingwin,params);
0055 end;

Generated on Tue 15-Aug-2006 22:51:57 by m2html © 2003