我正试图获得magnitud平方相干(MSC),但发现一些问题。 从理论上讲,MSC是两个信号的光谱的结果,由每个信号的自动光谱确定。
因此,这是我的代码:
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sampling period
L = length(myData(1,:)); % length of segment
Hz = Fs*(0:(L/2))/L; % frequency vector
dat1 = fft(myData(1,:));
dat2 = fft(myData(2,:));
pow1 = dat1.*conj(dat1); % autospectra signal 1
pow2 = dat2.*conj(dat2); % autospectra signal 2
cpow = abs(dat1.*conj(dat2)).^2; % crosspectra
coh = cpow./(pow1.*pow2); % getting the coherence
coherence = coh(1:L/2+1);
coherence(2:end-1) = coherence(2:end-1); % adjusting length to Nyquest freq
figure;
plot(Hz,coherence)
但是结果仅为“ 1”,并且没有太多的吸引力,因此我肯定有误,但我找不到。
感谢您的帮助