초기 입력 벡터의 길이를 보존하면서 입력 데이터 세트에서 스테핑 평균을 수행하는 것으로 보입니다. 내 지식으로는이 일을하는 단일 기능이 없습니다.
그러나 파이썬에서는 쉽게 할 수 있습니다. 예를 들어 :
def blurryAverage(inputCollection, step=1):
""" Perform a tiling average of an input data set according to its
step length, preserving the length of the initial input vector """
# Preconditions
if (len(inputCollection) % step != 0):
raise ValueError('Input data must be of divisible length')
ret = []
for i in range(len(inputCollection)/step):
tot = 0.0
for j in range(step):
tot += inputCollection[(i*step)+j]
for j in range(step):
ret.append(tot/step) # Implicit float coercion of step
return ret
>>> blurryAverage([1,2,3,4,5,6],3)
[2.0, 2.0, 2.0, 5.0, 5.0, 5.0]
>>> blurryAverage([1,2,3],4)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 3, in blurryAverage
ValueError: Input data must be of divisible length
이동 평균이 원하는 것처럼 읽습니다. 그 맞습니까? – PengOne
나는 당신이 달성하고자하는 것을 완전히 이해하지 못했지만, 당신은 [smooth] (http://www.mathworks.com/help/toolbox/curvefit/smooth.html)을보고 싶을 수도 있습니다. . –
예, 이동 평균은 제가 찾고있는 것입니다! 그 기능을 내장하고 있습니까? 또한 부드럽게 시도했지만, 너무 부드럽게하지 못했습니다. 내 그래프가 너무 '시끄 럽기'때문에 평균을 찾는 것만으로 잡음을 줄일 수 있습니다. – Bonk