欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

在Matlab中计算通道间相位滞后指数PLI矩阵的方法

最编程 2024-08-07 07:41:49
...

使用方法:输入X为例如(2000,16)形式的脑电信号,16代表通道数,2000为采样点。
在这里插入代码片

    function PLI=PhaseLagIndex(X)
% Given a multivariate data, returns phase lag index matrix
% Modified the mfile of 'phase synchronization'
ch=size(X,2); % column should be channel
%%%%%% Hilbert transform and computation of phases
% for i=1:ch
%     phi1(:,i)=angle(hilbert(X(:,i)));
% end
phi1=angle(hilbert(X));
PLI=ones(ch,ch);
for ch1=1:ch-1
    for ch2=ch1+1:ch
        %%%%%% phase lage index
        PDiff=phi1(:,ch1)-phi1(:,ch2); % phase difference
        PLI(ch1,ch2)=abs(mean(sign(sin(PDiff)))); % only count the asymmetry
        PLI(ch2,ch1)=PLI(ch1,ch2);
    end
end
for i=1:16
    PLI(i,i)=0;
end

推荐阅读