-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathplot_hfo_xcorr.m
55 lines (51 loc) · 1.28 KB
/
plot_hfo_xcorr.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
function plot_hfo_xcorr(si,Mx_hpc,Sx_hpc,label)
em=[Mx_hpc{:}]*1000;% Centers of ripples;
%one_sec=1.*1000;
tm=2*1000+1; %2 seconds
M=nan(size(si,2),tm);
M_envel=M;
%%
aver=(cellfun(@(equis1,equis2) (equis1-equis2)*1000,Mx_hpc,Sx_hpc,'UniformOutput',false));
ajalas=[aver{:}];
ajalas=ajalas+1;
%
ajalas=single(ajalas);
for i=1:size(M,1)
%M(i,tm/2-ajalas(i):tm/2-ajalas(i)+length(si{i})-1)=si{i}.';
M(i,round(tm/2)-ajalas(i):round(tm/2)-ajalas(i)+length(si{i})-1)=si{i}.';
M_envel(i,round(tm/2)-ajalas(i):round(tm/2)-ajalas(i)+length(si{i})-1)=abs(hilbert(si{i}.'));
end
% i=1
% M(i,:)
%%
m=nanmean(M_envel,1);
m(isnan(m))=0;
%plot((1:length(m))/1000,m)
t=-1:1/1000:1;
% subplot(1,2,1)
plot(t,m)
%xlim([tm/2-.200*(1000) tm/2+.200*(1000)])
hold on
%plot((1:length(m))/1000,abs(hilbert(m)))
% plot(t,abs(hilbert(m)))
if strcmp(label,'HPC')
xlim([-.200 .200] )
else
xlim([-.100 .100] )
end
xlabel('Seconds')
ylabel('uV')
% subplot(1,2,2)
% m=nanmean(M_envel,1);
% m(isnan(m))=0;
% plot(t,m)
% %xlim([tm/2-.200*(1000) tm/2+.200*(1000)])
% hold on
% %plot((1:length(m))/1000,abs(hilbert(m)))
% % plot(t,abs(hilbert(m)))
% if strcmp(label,'HPC')
% xlim([-.200 .200] )
% else
% xlim([-.100 .100] )
% end
end