Savitzky-Golay filter is used in signal processing to eliminate noise in a signal and improve its tendency. The filter calculates a polynomial fit of each window based on polynomial degree and window size.
SciPy API provides the savgol_filter() function to implement Savitzky-Golay filter in Python. In this tutorial, we'll briefly learn how to smooth the signal data by using savgol_filter() function in Python.
The tutorial covers:
- Preparing signal data
- Smoothing with Savitzky-Golay filter
- Source code listing
We'll start by loading the required libraries.
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt