Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. int hsgn(double input, double thresh){
  3.         int ret;
  4.         if(input > math.abs(thresh))
  5.                 ret = 1;
  6.         else if(input < math.abs(thresh))
  7.                 ret = -1;
  8.         else
  9.                 ret = 0;
  10.        
  11.         return ret;
  12. }
  13.  
  14. zeroCrossCounter(double input, double thresh){
  15.     static int xzc;
  16.     static int xc;
  17.  
  18.         int ysgn = hsgn(input, thresh);
  19.     int xzcn = kzc(ysgn, xzc);
  20.     xzc = xzcn;
  21.     int yzc = hzc(ysgn, xzc);
  22.     int xcn = kc(yzc, xc);
  23.     xc = xcn;
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement