3
$\begingroup$

Savitzky-Golay smoothing filters of polynomial degrees 4 and 6 have frequency response with ripples of roughly opposite signs. Thus averaging the coefficients of two filters of degrees d and d+2 is an easy way to attenuate the stopband:

enter image description here

Can anyone explain the roughly opposite ripples — or are they just a lucky coincidence ?

(The coefficients were generated with this python:

def savgol_coef( N=33, d=4 ):
    """ Savitzky-Golay filter coefficients
        see e.g. Numerical Recipes http://apps.nrbook.com/empanel/index.html?pg=772
        d odd, e.g. 5 -> av 4, 6: cutoff between, stopband lower
    """
    assert N % 2 == 1, "filter width N must be odd, not %d" % N
    if d % 2 == 1:
        return (savgol_coef( N, d - 1 )
            +   savgol_coef( N, d + 1 )) / 2  # roughly opposite ripples ?
    x = np.arange( - (N//2), N//2 + 1. )
    A = np.array([ x**k for k in range( d+1 )]) .T  # Ajk = basisk( xj )
    # print A
    return np.linalg.pinv( A )[0]
$\endgroup$

Your Answer

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

Browse other questions tagged or ask your own question.