-
Notifications
You must be signed in to change notification settings - Fork 0
/
Frecuency_pwelch.m
75 lines (45 loc) · 1.16 KB
/
Frecuency_pwelch.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
close all
clear all
clc
file='Paciente9_TMaze_epochs.mat'
load(file)
%%
canales_selecc=[10:10];
for t=1:size(canales_selecc,2)
nombre{t}=epochs(1).struct.chanlocs(canales_selecc(t)).labels
end
%%
for i=[1 2 9]
data3d = epochs(i).data;
data=[]
for j=1:size(data3d,3)
data=cat(2,data,squeeze(data3d(:,:,j)));
end
data=data';
%% check powerspectra of all channels
srate=epochs(i).struct.srate;
set_w=srate;%window
set_ov=0;%overlap
set_nfft=srate;%nfft
[Pxx,f] = pwelch(data(1:8*srate,1),set_w,set_ov,set_nfft,srate);
data_pxx=zeros(length(f),size(data,2));
for k=canales_selecc
[Pxx,f] = pwelch(data(1:8*srate,k),set_w,set_ov,set_nfft,srate);
data_pxx(:,k)=Pxx;
end
figure,hold on
plot(f,log(data_pxx),'k')
title(epochs(i).name)
size(data_pxx)
out(i,:,:)=data_pxx;
clear Pxx, f
end
%%
out=out+1;
%%
figure,hold on
plot(f,abs(log(squeeze(out(1,:,:)-out(2,:,:)))))
fontt=legend(nombre{:})
figure,hold on
plot(f,abs(log(squeeze(out(2,:,:)-out(8,:,:)))))
fontt=legend(nombre{:})