I am back with another question.
Context for the question: I am trying to smooth out the angular velocity data from an encoder. The encoder has 720 ppr and the rough angular speed of the wheel is around 327 rpm (5.45 Hz). Thus, the maximum update rate of the encoder is around 4000 Hz (encoder gives velocity update every pulse). My data acquisition setup samples at 16.67 kHz from the calculated speed. I have downsampled the signal to 4 kHz.
The recorded data is noisy mainly due to encoder eccentricity error (seen as low freq oscillations). But there is also a considerable amount of variation due to other encoder errors (cycle error, state width error, position error). By applying uncertainty propagation, I have found that to reduce the uncertainties to the desired value, I have to average over 20 points of data. i.e, I have to take one estimate every 20 samples by averaging all the 20 samples. I want the data to behave as if the encoder only gave a measurement every 20 pulses instead of one pulse. This will be the average angular speed over that much rotation.
Without knowing what a moving average filter was, I applied it and got a reasonable reduction in variations. However, then someone told me that moving average is not taking one sample for every 20 samples, and it doesn't reduce the no of samples. What I wanted to do (from my logic) was bin averaging. Here I divide the signal into several bins of 20 and take the mean, thereby reducing sampling freq to 200 Hz. I compared both the moving average and bin average methods in time and freq domain, shown below. Blue is signal at 4 kHz. Orange is moving average. Yellow is bin average.
FFT of moving average and original signal
FFT of bin average and original signal
In the time domain, both look similar, although by zooming in, the variations in the bin average is lower, which I understand. The problem comes in freq domain. I compared fft of both filters to the fft of the downsampled signal. Here the moving average heavily attenuates frequencies above 200 Hz, which I understand. For the bin average, fft only goes till 100 Hz, BUT, there is a false peak introduced at 77 Hz which is not there in the original signal! WHERE IS THIS COMING FROM?
I want to use the bin average, because the logic behind it I understand. But if it modifies the frequency content, then I shouldn't use it probably. Would someone please explain why a random peak is generated in the bin averaging method? I tried on a different dataset (different repeat of the same experiment) still this remains. Please help!