标签:legend mamicode 平滑 AMM http txt image port import
巴特利特窗是一种三角形平滑窗
import numpy as np import matplotlib.pyplot as plt window = np.bartlett(42) plt.plot(window) plt.show()
布莱克曼窗形式上是三项余弦值的加和
import numpy as np import matplotlib.pyplot as plt from matplotlib.dates import datestr2num closes = np.loadtxt(‘AAPL.csv‘, delimiter=‘,‘, usecols=(6,), converters={1:datestr2num}, unpack=True) N = 10 window = np.blackman(N) smoothed = np.convolve(window/window.sum(), closes, mode="same") plt.plot(smoothed[N:-N], lw=2, label="smoothed") plt.plot(closes[N:-N], label="closes") plt.legend(loc="best") plt.show()
汉明窗是一个加权的余弦函数
hamming函数唯一的参数是输出点的个数
import numpy as np import matplotlib.pyplot as plt window = np.hamming(142) plt.plot(window) plt.show()
凯泽窗是以贝塞尔函数定义的
第一个参数为输出点的个数, 第二个参数为贝塞尔函数中的参数值
import numpy as np import matplotlib.pyplot as plt window = np.kaiser(42, 14) plt.plot(window) plt.show()
import numpy as np import matplotlib.pyplot as plt window = np.kaiser(42, 4) plt.plot(window) plt.show()
标签:legend mamicode 平滑 AMM http txt image port import
原文地址:https://www.cnblogs.com/draven123/p/11427206.html