我匹配的400毫秒2個波形。我正在使用關聯來檢查班次。
cc = correlate(b1,b2,mode="same")
n=len(cc)
cc=2*cc/n
dur=n*dt1/2;
d=linspace(-dur, dur, n)
idx = argmax(cc)
我正在2波形之間切換。但如何獲得兩個波形的實際匹配位置?
我匹配的400毫秒2個波形。我正在使用關聯來檢查班次。
cc = correlate(b1,b2,mode="same")
n=len(cc)
cc=2*cc/n
dur=n*dt1/2;
d=linspace(-dur, dur, n)
idx = argmax(cc)
我正在2波形之間切換。但如何獲得兩個波形的實際匹配位置?
你可能想mode = "full"
和需要做一些更多的數學挑選相關峯和調整序列長度填充
希望這個例子將有助於顯示的問題:
import math
import numpy as np
import matplotlib.pyplot as plt
a = [math.sin(i* math.pi/10) for i in range(300)]
b = [math.cos(i*math.pi/10) for i in range(300)]
plt.plot(a, 'red')
plt.plot(b, 'green')
axb= np.correlate(a,b, mode="full")/100.0
x = range(len(axb))
plt.plot(x, axb)
您得到的轉變是您需要移動b1以使其與b2達到最大共生關係的轉變。 –
我附上了圖像。兩者之間的平移是0.015 ms。我可以移動0.015 ms,但實際匹配從0.26 ms開始 – deep