Last active
December 18, 2015 11:05
-
-
Save multivac61/8a259df0bc975f605db7 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 freq_from_ZCR(sig, fs): | |
# Find all indices right before a rising-edge zero crossing | |
indices = find((sig[1:] >= 0) & (sig[:-1] < 0)) | |
crossings = interpolate(indices, sig) | |
return fs / np.mean(np.diff(crossings)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment