Matlab Coherence function

12 ビュー (過去 30 日間)
Don
Don 2011 年 2 月 19 日
コメント済み: Youssef Khmou 2014 年 4 月 4 日
The wavelet tool box I recently purchased does not seem to have the kind of coherence function that I need. This may be a lack of understanding on my part but what I was looking for was a function that is described as a magnitude squared coherence function which produces a single vector that varies from 0 to 1. It is not at all clear to me how I can get this out put from the function called wcoher that is in my just got it tool box. Any advice would be appreciated.
Thanks
  1 件のコメント
Jakub
Jakub 2013 年 4 月 12 日
Wcoher function gives you wavelet coherence. It's function of time(samples) and scales. Scales represent frequency(see scal2frq function). Input of wcoher are two vectors. You obtain information about coherence for each pair of samples and for each scale(frequency).

サインインしてコメントする。

採用された回答

Katherine
Katherine 2014 年 4 月 2 日
Have you tried mscohere?
  1 件のコメント
Youssef  Khmou
Youssef Khmou 2014 年 4 月 4 日
mscohere is the appropriate proposition, i accept this answer .

サインインしてコメントする。

その他の回答 (2 件)

Tahani
Tahani 2013 年 8 月 15 日
Is there any way to display the coherence vector as a coloured image. for example blue colour refers to high coherence and red refers to low coherence. in addition to the coherence values between those significant markers.

Youssef  Khmou
Youssef Khmou 2013 年 4 月 12 日
hi Don
try this function :
function [MSC]=coherence_MVDR(x1,x2,L,K)
%%This program computes the coherence function between 2 signals
%%x1 and x2 with the MVDR method.
%%This algorithm is based on the paper by the same authors:
%%J. Benesty, J. Chen, and Y. Huang, "A generalized MVDR spectrum,"
%%IEEE Signal Processing letters, vol. 12, pp. 827-830, Dec. 2005.
%%x1, first signal vector of length n
%%x2, second signal vector of length n
%%L is the length of MVDR filter or window length
%%K is the resolution (the higher K, the better the resolution)
%initialization
xx1 = zeros(L,1);
xx2 = zeros(L,1);
r11 = zeros(L,1);
r22 = zeros(L,1);
r12 = zeros(L,1);
r21 = zeros(L,1);
%construction of the Fourier Matrix
F = zeros(L,K);
l = (0:L-1)';
f = exp(2*pi*l*j/K);
for k = 0:K-1
F(:,k+1) = f.^k;
end
F = F/sqrt(L);
%number of samples, equal to the lenght of x1 and x2
n = length(x1);
for i = 1:n
xx1 = [x1(i);xx1(1:L-1)];
xx2 = [x2(i);xx2(1:L-1)];
r11 = r11 + xx1*conj(xx1(1));
r22 = r22 + xx2*conj(xx2(1));
r12 = r12 + xx1*conj(xx2(1));
r21 = r21 + xx2*conj(xx1(1));
end
r11 = r11/n;
r22 = r22/n;
r12 = r12/n;
r21 = r21/n;
%
R11 = toeplitz(r11);
R22 = toeplitz(r22);
R12 = toeplitz(r12,conj(r21));
%
%for regularization
Dt1 = 0.01*r11(1)*diag(diag(ones(L)));
Dt2 = 0.01*r22(1)*diag(diag(ones(L)));
%
Ri11 = inv(R11 + Dt1);
Ri22 = inv(R22 + Dt2);
Rn12 = Ri11*R12*Ri22;
%
Si11 = real(diag(F'*Ri11*F));
Si22 = real(diag(F'*Ri22*F));
S12 = diag(F'*Rn12*F);
%
%Magnitude squared coherence function
MSC = real(S12.*conj(S12))./(Si11.*Si22);

カテゴリ

Help Center および File ExchangeContinuous Wavelet Transforms についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by