Re: triggering on rising or falling edges?
- To: mathgroup at smc.vnet.net
- Subject: [mg73205] Re: triggering on rising or falling edges?
- From: "Ray Koopman" <koopman at sfu.ca>
- Date: Wed, 7 Feb 2007 05:50:37 -0500 (EST)
- References: <eq4ge0$dsr$1@smc.vnet.net>
On Feb 4, 3:35 am, "dantimatter" <dantimat... at gmail.com> wrote: > hello all, > > is there a way for me to detect only the rising or falling edge of a > step function?? right now i'm using a conditional test that doesn't > differentiate between the system going from 0 -> 1 and 1 -> 0. i'd > really like it if the system would only trigger on the 0 -> 1 > transition. does anyone know if this is possible?? > > thanks, > dan Is this what you're looking for? It returns the position of the first 0 that is followed by a 1. In[1]:= s = Table[Random[Integer],{20}] Out[1]= {0,0,0,1,0,0,1,0,0,1,0,0,0,1,1,1,1,1,0,0} In[2]:= Position[Rest@s-Most@s, 1, {1}, 1] Out[2]= {{3}}