4
$\begingroup$

Consider having a signal in the time domain, and you want to smooth the signal. Moving average and Gaussian filters that are used. How do you choose which is used for what?

What are the conditions under which Gaussian is better and conditions under which moving average is better?

enter image description here

What I am trying to do with this signal is, peak detection initially, then apply small windows on every part and figure out the frequency changes (Doppler shifts) for every part to figure out the direction of motion from the frequency change. I want to smoothen out the signal in time-domain without loss of information in the frequency domain. I thought for the part of figuring out the Doppler shifts, using STFT would be a good idea.If reference could be given to some paper, that would also be really helpful.

$\endgroup$
  • 3
    $\begingroup$ Such a discussion of "under which conditions which type of filter is better" would be too long. Instead you just try the two filters and tell us which one produces the better output for your application. $\endgroup$ – Fat32 Sep 29 '16 at 13:02
  • 1
    $\begingroup$ Happy new years, and a reminder of this question and its answers requiring some action $\endgroup$ – Laurent Duval Dec 31 '16 at 16:15
  • 1
    $\begingroup$ Can you give more specifics on how you got the signal to add to "This is a signal I obtained from a mobile device, for a rotatory hand swipe motion". I am curious what frequency content you expect and the characteristics of the Doppler. With that I may be able to offer more suggestions. $\endgroup$ – Dan Boschen Mar 7 '17 at 2:46
  • $\begingroup$ I made a rotating hand device that is controlled by a motor. I made an android app to collect any audio signals that it receives and also send a 20 Khz signal. This image you see above is that of the received signal from the rotating device in the android app. $\endgroup$ – Dinesh Sep 5 '17 at 9:58
3
$\begingroup$

A centered moving average filter is a finite impulse response (FIR) filter that affects the same weight to all the samples in the window. If you only care about time domain properties, and do not care about its relatively poor performance in the spectral domain, for a signal $s$ that is quite stationary across the window, you can use it. It has extremely fast running implementation, and can be used easily for very short signals. In the spectral domain, suppose that you have the same signal amplitude at three frequencies $f_1 < f_2 <f_3$: $|S(f_1)| = |S(f_2)|=|S(f_3)|$. The amplitude spectrum of this filter is nondecreasing in general. So you you may end up with a filtered signal $s'$ for which $|S'(f_2)| = 0 < |S'(f_1)| < |S'(f_3)|$. In other words, the frequency behavior is not completely natural.

Looking at your signal in time domain, quite long and with a non stationary behavior, a Gaussian filter could be a wiser choice, if you have only these two options, and if online filtering or back feedback are not an issue. It is an infinite impulse response filter. It provides a nice tradeoff between the time and the frequency domain (in which its response is decreasing). And allow some fast recursive implementations too. You can even emulate an approximation of a Gaussian filter by combining several moving average ones of different lengths.

So I would go for the Gaussian, if your only goal is to smooth the signal. But I believe that for more involved processing, other filters could be more appropriate. Beware of the singularity at the right end, though.

$\endgroup$
  • 1
    $\begingroup$ This is a signal I obtained from a mobile device, for a rotatory hand swipe motion. I am trying out different filters on it to figure out which could be good to get a smooth signal where detecting peaks would be very easy. I also want to find the micro-Doppler shifts from the signal. So, I do not wish to lose the information in the frequency domain when I apply short-time Fourier transform to the signal. I would like to know which filters are advisable to be tested on this ? $\endgroup$ – Dinesh Oct 5 '16 at 13:50
  • 1
    $\begingroup$ Do you want to detect the 50 something positive "peaks" of the signal? Do you want to apply a STFT after filtering? $\endgroup$ – Laurent Duval Oct 5 '16 at 20:19
  • 1
    $\begingroup$ I want to detect the peaks, then apply small windows on every part and figure out the frequency changes (Doppler shifts) for every part to figure out the direction of motion. I thought for the part of figuring out the Doppler shifts, using STFT would be a good idea... If you can give reference to some paper, that would also be really helpful. $\endgroup$ – Dinesh Oct 6 '16 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.