Home > functions > estimation > bayes > vb_calc_timewindow.m

vb_calc_timewindow

PURPOSE ^

SYNOPSIS ^

function Twindow = vb_calc_timewindow(Tsample,Tperiod,Tnext)

DESCRIPTION ^

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function Twindow = vb_calc_timewindow(Tsample,Tperiod,Tnext)
0002 %
0003 % Copyright (C) 2011, ATR All Rights Reserved.
0004 % License : New BSD License(see VBMEG_LICENSE.txt)
0005 
0006 % Time window calculation
0007 if length(Tnext)==1, 
0008   Nperiod = ceil((Tsample - Tperiod)/Tnext + 1); % Number of periods
0009   Tbegin = 1:Tnext:((Nperiod-1)*Tnext + 1); % Start time index
0010   Tend     = min(Tbegin + Tperiod - 1, Tsample);    % End time index
0011 elseif length(Tnext)~=length(Tperiod), 
0012   error('Tnext and Tperiod must be the same length.');
0013 else 
0014   Nperiod = length(Tnext); 
0015   Tbegin = Tnext;
0016   Tend = Tbegin+Tperiod-1; 
0017   if max(Tend)>Tsample, 
0018     error(['Time window exceeds the length of the MEG' ...
0019        ' meassurement.']);
0020   end
0021 end
0022 Twindow  = [Tbegin' Tend'];

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005