Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int hsgn(double input, double thresh){
- int ret;
- if(input > math.abs(thresh))
- ret = 1;
- else if(input < math.abs(thresh))
- ret = -1;
- else
- ret = 0;
- return ret;
- }
- zeroCrossCounter(double input, double thresh){
- static int xzc;
- static int xc;
- int ysgn = hsgn(input, thresh);
- int xzcn = kzc(ysgn, xzc);
- xzc = xzcn;
- int yzc = hzc(ysgn, xzc);
- int xcn = kc(yzc, xc);
- xc = xcn;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement