位相差の求め方
조회 수: 17 (최근 30일)
이전 댓글 표시
現在19ch×100のデータがあります。
これの位相差を求めたいです。
1chに注目した時の1chと1ch、1chと2ch、1chと3ch。。。。。1chと19ch
2chに注目した時2chと1ch、2chと2ch。。。。。2chと19ch
これを19chに注目した時までの位相を求めたいです
1chと2chだけの位相差であれば1chー2chをするだけなのですが、
これを全部書くことはかなり時間かかるのでforloopなどで簡単に出来るやり方がありましたら
スクリプトを送っていただきたいです。
よろしくお願いいたします。
下記スクリプトは全体ではないですが5chー10chの位相差のスクリプトになります
上の方のでα波取り出しとヒルベルト変換していますが、それぞれ全体の位相差部分のスクリプトだけで大丈夫です。
data=record(5,:);
samplerate=250;
length=231250;
t=(0:length-1)/samplerate;
srate=250;
locutoff=8;
hicutoff=13;
smoothdata1 = eegfilt(data,srate,locutoff,hicutoff);
y1=hilbert(smoothdata1);%ヒルベルト変換
p=angle(y);
hold on
data1=record(10,:);
length=231250;
p2=angle(y1); %位相
dif1=p-p2;%位相差(5-10ch)
댓글 수: 0
채택된 답변
Atsushi Ueno
2021년 11월 12일
편집: Atsushi Ueno
2021년 11월 12일
for idx1 = 1:19
for idx2 = 1:19
% 関数でangleを取ってからi番目のchに注目した時の位相差を処理してください
% 19×100が19個出来ると思います。
angle1 = get_angle(record(idx1,:));
angle2 = get_angle(record(idx2,:));
dif1{idx1,idx2} = angle1 - angle2;
end
end
function p = get_angle(data)
srate = 250;
locutoff = 8;
hicutoff = 13;
smoothdata1 = eegfilt(data,srate,locutoff,hicutoff);
y = hilbert(smoothdata1);%ヒルベルト変換
p = angle(y); %位相
end
댓글 수: 0
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!