function out = SG_filter( f, n_l, n_r, M )

A = vander(-n_l:n_r);
A = A(:,n_l+n_r+1-M:end);
[Q,R] = qr(A);
c = 1/R(M+1,M+1) * Q(:,M+1);
out = conv(f,c);

end

