📜  numpy.correlate()函数– Python

📅  最后修改于: 2022-05-13 01:55:03.530000             🧑  作者: Mango

numpy.correlate()函数– Python

numpy.correlate()函数定义两个一维序列的互相关。此函数计算信号处理文本中通常定义的相关性:c_{av}[k] = sum_n a[n+k] * conj(v[n])

代码#1:

# Python program explaining
# numpy.correlate() function
       
# importing numpy as geek 
import numpy as geek 
   
a = [2, 5, 7]
v = [0, 1, 0.5]
   
gfg = geek.correlate(a, v)
   
print (gfg)

输出 :

[8.5]


代码#2:

# Python program explaining
# numpy.correlate() function
       
# importing numpy as geek 
import numpy as geek 
   
a = [2, 5, 7]
v = [0, 1, 0.5]
   
gfg = geek.correlate(a, v, "same")
   
print (gfg)

输出 :

[4.5 8.5 7. ]