-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmych26.m
62 lines (53 loc) · 1.81 KB
/
mych26.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
function mych26(seedelec, freqband, numfreqs, timewin)
if ~exist('freq', 'var')
freqband = [4 8];
end
if ~exist('numfreqs', 'var')
numfreqs = 5;
end
if ~exist('timewin', 'var')
timewin = [300 350];
end
datafile = 'sampleEEGdata.mat';
load(datafile);
if ~exist('seedelec', 'var')
% seedelec = 1;
chan2use = 'P1';
seedelec = find(strcmpi({EEG.chanlocs.labels}, chan2use));
end
freqs = linspace(freqband(1), freqband(end), numfreqs);
convmat = mywavconv(EEG.data, EEG.srate, freqs);
% do ISPC-trials:
ispcmat = myISPCtrials_seeded(convmat, seedelec);
ispcmat_freqmean = mean(ispcmat, 3);
timeinds = find(EEG.times>=timewin(1) & EEG.times<timewin(2));
ispcmat_timewin = mean(ispcmat_freqmean(:,timeinds), 2);
figure; topoplot(ispcmat_timewin, EEG.chanlocs, 'electrodes', 'off', ...
'plotrad', .53, 'maplimits', [0 1]);
colorbar;
title('ISPC-trials');
% do PLI:
plimat = myPLItrials_seeded(convmat, seedelec);
plimat_freqmean = mean(plimat, 3);
plimat_timewin = mean(plimat_freqmean(:,timeinds), 2);
figure; topoplot(plimat_timewin, EEG.chanlocs, 'electrodes', 'off', ...
'plotrad', .53, 'maplimits', [0 .2]);
colorbar;
title('PLI');
% do wPLI:
wplimat = myWPLItrials_seeded(convmat, seedelec);
wplimat_freqmean = mean(wplimat, 3);
wplimat_timewin = mean(wplimat_freqmean(:,timeinds), 2);
figure; topoplot(wplimat_timewin, EEG.chanlocs, 'electrodes', 'off', ...
'plotrad', .53, 'maplimits', [-.2 .2]);
colorbar;
title('wPLI');
% do imaginary coherence:
icmat = myimagcohtrials_seeded(convmat, seedelec);
icmat_freqmean = mean(icmat, 3);
icmat_timewin = mean(icmat_freqmean(:,timeinds), 2);
figure; topoplot(icmat_timewin, EEG.chanlocs, 'electrodes', 'off', ...
'plotrad', .53, ...
'maplimits', [0 .125]);
colorbar;
title('imaginary coherence');