PLV - phase locking value 锁相值 MATLAB代码

今天为了研究生工作需要,一直在找PLV的代码。因为有的代码很难用,在这里分享一下我找到的相对好用的代码。

代码地址如下:

https://ww2.mathworks.cn/matlabcentral/fileexchange/71739-plv-phase-locking-value?s_tid=srchtitle

代码如下:

function [ plv ] = PLV( phase_sig1, phase_sig2 )
% Compute the Phase Locking Value between two signals across trials, according to Lachaux, 
% Rodriguez, Martinerie, and Varela (1999). The PLV value ranges from 0, indicating random 
% phase differences, to 1 indicating a fixed phase difference. 
% phase_sig1 and phase_sig2 should be the phase values of the signals in radians, arranged as
% Samples x Trials. These can bed
% computed using the Wavelet or Hilbert transform, for example:
% phase_sig = angle(hilbert(BPS)); 
% Where BPS is the signal after band-pass filtering around the frequency range of interest. 

% Written by Edden Gerber 2012
[~, Ntrials] = size(phase_sig1);
% compute PLV
e = exp(1i*(phase_sig1 - phase_sig2));
plv = abs(sum(e,2)) / Ntrials;
end

这个代码在用之前需要我们手动计算信号的相位值,具体见代码自带注释,大概是angle(hilbert(信号))这样。

……第一次投稿,代码不是我写的 但是这博客是我写的,姑且先用原创这个分类

  • 5
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值