SHOW:
|
|
- or go back to the newest paste.
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 | } |