I have a signal which is taken from an accelerometer and I'm trying to match patterns between different windows of the signal by cross correlation. To do this I take different windows of the signal, sliding it on the signal and taking cross correlation and I'm hopping to find similarity between different windows by finding the peaks of my cross correlation. However what I see is that no matter what window of the signal I use, I get peaks on some specific points on my signal! I usually don't even get peaks on the point where the window itself was taken from. My first observation was that the peak points were located on noisy parts of the signal were the signal had a high magnitude nearby (which was an outlier compared to the rest of the signal.) So I did a preprocessing and removed the outliers. But I still get the same result on some other points on the signal. I also use the following formula for cross correlation:
So the signals have a mean on 0 and cross correlation is normalized by their standard deviation. So the questions I have are what am I doing wrong and how can I fix this? maybe additional preprocessing or an alteration in my formula? How can I know if cross correlation is a suitable similarity measure for my task or not? What other alternative methods do you suggest?
Additional Information: I used this python implementation of cross correlation in my code. I also post an image of my signal and points which have high correlation with nearly every window. In this image the red curve is my signal. The two windows which show strong correlation to other windows dosn't look to have any special characteristics (high magnitude, etc).