Q:

How to smooth a signal?

The easiest way to smooth a signal is by moving window average.
A more advanced way is to use a Savitzky-Golay filter. 
From wikipedia:

The main advantage of this approach is that it tends to preserve
  features of the distribution such as relative maxima, minima and
  width, which are usually 'flattened' by other adjacent averaging
  techniques (like moving averages, for example).

There is also a whole range of window functions.
As I understand this: any finite filter wil cause spectral leakage,
but the moving window average is the worst. E.g. a Gaussian window is better in this respect.
Is flattening and spectral leakage the same?
When should one use Savitzky-Golay and when should one use Gauss, Hann, Hamming etc?
Thanks in advance for any answers!   

A:

When using a moving average filter, or rectangular convolution in the time domain, the time domain smoothing and so-called spectral leakage are nearly opposing effects.  The smoothing is due to removing high frequency content, and the leakage is the name given for portions of this frequency content that end up not being removed.  Since sharp peaks and transients can be partially composed of high frequency content, smoothing by this kind of convolution can diminish them.
Time-domain convolution windows other than rectangular may remove less of the very nearby frequencies, but better remove more of the far away frequency content (relative to some transition frequency, which is related approximately to the window width).
An adaptive polynomial regression will remove different spectral characteristics from a signal at different points in time, which could either expose or hide "important" elements of the signal, depending on the signal, and what you are looking for.

