曲線平滑(smoothing)


曲線平滑

Savitzky-Golay濾波器

Python Scipy Signal Library ---- savgol_filter

詳解:Savitzky-Golay平滑濾波

It uses least squares to regress a small window of your data onto a polynomial, then uses the polynomial to estimate the point in the center of the window. Finally the window is shifted forward by one data point and the process repeats. This continues until every point has been optimally adjusted relative to its neighbors.

FFT濾波器

Gaussian Filter

https://stackoverflow.com/questions/8055489/smoothing-data-in-contour-plot-with-matplotlib

Kalman Filter

移動平均法(鄰域平均值濾波器)

http://en.wikipedia.org/wiki/Moving_average

https://stackoverflow.com/questions/8055489/smoothing-data-in-contour-plot-with-matplotlib

One simple form of moving average is to calculate the average of adjacent measurements at a certain position. In a one-dimensional series of measurements a[1:N], for example, the moving average at a[n] can be calculated as a[n] = (a[n-1] + a[n] + a[n+1]) / 3, for example. If you go through all of your measurements, you're done. In this simple example, our averaging window has size 3. You can also use windows of different sizes, depending on how much smoothing you want

Use an algorithm based on convolution to make the calculation easier. The advantage of using convolution is that you can choose different kinds of averages, like weighted averages, by simply changing the window.

from scipy.signal import convolve
# if z is 1d array, m is the window shape(moving average num)
z1 = convolve(z, np.ones(m))


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM