# Differences in moving window rms due to sampling rate

I have a 10 second recorded signal band pass filtered from 100-500 Hz. The original sampling rate is 10 kS. Now I run a moving window RMS with a window length: 10 ms on the signal (10/1000 * sampling rate). I then find the samples of the RMS signal that are greater than 2 SD from mean. I get a total number of, say, 4894 samples that satisfy this condition.

Now I down sample the signal to 2 kS, and do the same process with the recalculated window length also of 10 ms (but different sample length due to the sampling rate). When I apply the same >2 SD criteria I get 974 samples.

I then use the sample indices from the two different cases to see if they are indeed the same samples by normalizing the indices by sampling rate times 1000 to get ms precision.

Then I compute the intersection of these two sets of times when s.d > 2 for both the sampling rates.

I get a value of around 700. I am trying to understand why. Shouldn't all the samples times in the set corresponding to the 2 kS sampling rate actually be a subset of the sampling times seen in the 5 kS sampling rate for the > 2 SD criteria?

## 1 Answer

Shouldn't all the samples times in the set corresponding to the 2 kS sampling rate actually be a subset of the sampling times seen in the 5 kS ?

Not necessarily. It depends on how you do the down sampling. If you use an anti-aliasing lowpass filter, it typically induces time delay and/of phase distortion. If you don't, you probably end up with some residual aliasing, since there is no such thing as a true "band limited" signal.

Could also be rounding errors when you determine the sample locations.

• Thanks that makes sense. I am down sampling without decimating so I guess there is aliasing. The thing is I am trying to detect certain events with this > 2 S.D criteria and additional criteria such as sustained > 2.SD for a certain amount of continuous samples. The issue I have is while there is an 70-80% overlap of detected events for the two sampling rates, the remaining detected events are naturally different for the two sampling rates. I am wondering which sampling rate gives the 'true' detected events? – sk7 Apr 20 '19 at 23:16