-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFrecuency_pwelch_cont.m
88 lines (54 loc) · 1.41 KB
/
Frecuency_pwelch_cont.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
close all
clear all
clc
%
% fname='Farinelli_DBT1_P1_PreProc_Filt'
% file=[fname '.set']
% path_set='E:\iEEG\9_Farinelli Alfredo\DBT\'
%
%
% eeglab
% EEG = pop_loadset('filename', file ,'filepath', [path_set 'Filt\']);
% EEG = eeg_checkset( EEG );
% eeglab redraw
fname='Repossini_DBT_PII_Filt'
file=[fname '.set']
path_set='E:\iEEG\10_Repossini_Florencia\DBT\Filt\'
eeglab
EEG = pop_loadset('filename', file ,'filepath', [path_set]);
EEG = eeg_checkset( EEG );
eeglab redraw
%%
data=EEG.data;
srate=EEG.srate;
%% Calculate bad channels . noisy ones
a=var(data');
b=find(a>(5*median(a)));
c=find(a<(median(a)/5));
sub_info.bad_chans1=[];
if ~isempty([b c])
disp(['additional bad channels: ' int2str(setdiff([b c],[sub_info.bad_chans1]))]);
end
disp('add additional bad channel when prompted')
%%
nr_jumps=zeros(1,size(data,1));
for k=1:size(data,1);
nr_jumps(k)=length(find(diff(data(k,:))>100)); % find jumps>80uV
end
figure,plot(nr_jumps);
find(nr_jumps>0);
%%
set_w=srate;%window
set_ov=0;%overlap
set_nfft=srate;%nfft
% [Pxx,f] = pwelch(data(:,1:100*srate),set_w,set_ov,set_nfft,srate);
for k=1:size(data,1)
[Pxx,f] = pwelch(data(k,1:200*srate),set_w,set_ov,set_nfft,srate);
data_pxx(:,k)=Pxx;
end
figure,hold on
plot(f,log(data_pxx),'k')
size(data_pxx)
% figure,hold on
% plot(f,abs(log(squeeze(out(1,:,:)-out(2,:,:)))))
% fontt=legend(nombre{:})