Is this a common filtering technique? I multiplied each sample with it's neighbor.

I was trying to distinguish the spikes from the noise. Low-pass filtering wasn't as helpful maybe because both the spikes and the noise are kind of high frequency.

TOP: filtered, BOTTOM: unfiltered

Spectrogram showing two signals: top: out; bottom: in

Spectrogram showing two signals: top: out; bottom: in

  • \$\begingroup\$ FWIW, since you have an almost-constant dB level of noise, you can use thresholding (possibly with e.g. hysteresis and other options if you need them) for such data instead. In EE contexts, sometimes even a simple diode would do the trick. \$\endgroup\$ – user20088 Dec 10 '16 at 18:49

You basically squared the signal. If you were sampling properly fast, then the small shift due to multiplying by the next sample instead of the same sample only had minor effect on high frequencies.

Squaring a signal is a non-linear operation. The reason it appears to give lower signal to noise ratio is only because your noise was already lower than the signal spikes you are looking for. Squaring de-emphasizes weak signals proportional to their weak-ness.

For example, consider a raw signal that contains noise with amplitude ±.1, and the spikes you are looking for go to 1.0. That is a 10:1 signal to noise ratio. After squaring, the noise is ±.01 and the spikes still 1.0, for a apparent ratio of 100:1.

However, in the above example you haven't really reduced the noise relative to the signal, just made the noise less obvious. Let's say that after looking at the "cleaned" signal, you decide to set the threshold for detecting a spike to 0.5. This is exactly the same as starting with the original signal and setting the threshold to 0.71. You only have the illusion of more noise immunity, not actual noise immunity. Any noise in the original signal rising to 0.71, on in the squared signal to 0.50, will be interpreted as a spike.

  • \$\begingroup\$ Ah, yeah squaring it has basically the same effect. I see what you're saying on the SNR not actually being reduced, it just appears that way to my feeble human mind. \$\endgroup\$ – Keegan Jay Dec 10 '16 at 17:17
  • \$\begingroup\$ Although... if two consecutive spike samples tend to both be large, while two consecutive samples of noise are random, then doesn't the multiply-neighbor method incorporate more useful information than the squaring method? \$\endgroup\$ – Keegan Jay Dec 10 '16 at 17:29
  • 1
    \$\begingroup\$ @Jay: Combining neighboring samples adds some low pass filtering. If that's useful, it would be better to do more deliberate and controlled low pass filtering. \$\endgroup\$ – Olin Lathrop Dec 10 '16 at 19:36

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.