我ms-coherence在两个信号之间进行分析,并将结果scipy.signal.coherence与 Matlab 的mscohere函数进行比较。当我在两个函数中使用相同的参数时,我没有得到相同的结果:
MATLAB
x = [1,3,5,7,4,6,7,8,9,3,5,6]
y = [3,4,7,8,9,1,2,3,4,1,5,6]
[cxy,w] = mscohere(x,y,hann(6),3,6,1)
cxy =
0.7489
0.6034
0.2813
0.3319
w =
0
0.1667
0.3333
0.5000
Python
from scipy.signal import coherence
x = [1,3,5,7,4,6,7,8,9,3,5,6]
y = [3,4,7,8,9,1,2,3,4,1,5,6]
coherence(x,y,'hann',noverlap=3,nperseg=6,fs=1,detrend=False)
(array([0. , 0.16666667, 0.33333333, 0.5 ]),
array([0.76762535, 0.53185638, 0.32743784, 0.07759385]))
我错过了什么?