Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

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}}



  • Prev by Date: Mathematica, Quad Core, Linux
  • Next by Date: RE: String to number
  • Previous by thread: triggering on rising or falling edges?
  • Next by thread: make InputForm output cells have the same multi-click expression selection behavior as InputForm input