2 % GETTRIGGER identifies trigger points
4 % TRIG =
gettrigger( s [,TH [,rfp]]); % trigger at ascending edge
5 % TRIG =
gettrigger(-s [,TH [,rfp]]); % trigger at decending edge
8 % TH Threshold;
default: (max+min)/2
9 % rfp refractory period (
default=0)
10 % output: TRIG TRIGGER time points
14 % $Id:
gettrigger.m 2202 2009-10-27 12:06:45Z schloegl $
15 % Copyright (C) 2002-2003,2008 by Alois Schloegl <a.schloegl@ieee.org>
17 % This library is free software; you can redistribute it and/or
18 % modify it under the terms of the GNU Library General Public
19 % License as published by the Free Software Foundation; either
20 % Version 2 of the License, or (at your option) any later version.
22 % This library is distributed in the hope that it will be useful,
23 % but WITHOUT ANY WARRANTY; without even the implied warranty of
24 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 % Library General Public License
for more details.
27 % You should have received a copy of the GNU Library General Public
28 % License along with
this library;
if not, write to the
29 % Free Software Foundation, Inc., 59 Temple Place - Suite 330,
30 % Boston, MA 02111-1307, USA.
34 TH = (max(s)+min(s))/2;
40 TRIG = find(diff(sign(s-TH))>0)+1;
41 % perform check of trigger points
43 if (rfp<=0),
return; end;
48 while k1<length(TRIG);
58 TRIG=TRIG(~isnan(TRIG));