I am trying to create two python methods that provides ZCR & MCR of an array as mentioned in the research paper
Here are my code for ZCR :
def getZeroCrossingRate(self,arr):
my_array = np.array(arr)
return float("{0:.2f}".format((((my_array[:-1] * my_array[1:]) < 0).sum())/len(arr)))
Input : [1,2,-3,4,5,-6,-2,-6,2]
Output : 0.44
For MCR , should i average out the ZCR calculated from other segments ?
You can use your ZCR function to compute the MCR like so:
def getMeanCrossingRate(self, arr):
return self.getZeroCrossingRate(np.array(arr) - np.mean(arr))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.