Created
June 20, 2023 13:41
-
-
Save adisuciu/558c24c75de5354c422a1842198288d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def compute_zero_crossing(array): | |
prev = array[0] | |
cnt = 0 | |
last_sign = get_sign(prev) | |
for i in array[1:]: | |
sign = get_sign(i - prev) | |
prev = i | |
if(sign != last_sign): | |
cnt+=1 | |
last_sign = sign | |
return cnt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment