-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmethod2.m
62 lines (56 loc) · 1.31 KB
/
method2.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
% Requires MiningSuite, github version
% http://olivierlar.github.io/miningsuite/
load hey_ya_detection_function
s = sig.Signal(detecfunc(:,2),'Srate',100);
p0 = sig.peaks(s,'Contrast',.01,'Order','Abscissa');
d0 = get(p0,'PeakPos');
dp0 = d0.content{1};
ddp0 = dp0(2) - dp0(1);
p = sig.peaks(s,'Threshold',.33,'Order','Abscissa');
d = get(p,'PeakPos');
v = get(p,'PeakVal');
dp = d.content{1};
dv = v.content{1};
ddp = diff(dp);
sequ = [];
i = 1;
oldr = [];
while i <= length(ddp)
r = round(ddp(i)/ddp0);
if i > 1 && i < length(ddp) && r == oldr && dv(i+1) < dv(i)
r2 = round(ddp(i+1)/ddp0);
if r2 < r
r = r + r2;
ddp(i+1) = [];
dv(i+1) = [];
end
end
%sequ(end+1:end+r) = 1:r;
sequ(end+1) = r;
i = i + 1;
oldr = r;
end
figure,plot(sequ,'*')
%%
load love_is_all_ddf
s = sig.Signal(ddf(:,2),'Srate',100);
p0 = sig.peaks(s,'Contrast',.01,'Order','Abscissa');
d0 = get(p0,'PeakPos');
dp0 = d0.content{1};
ddp0 = dp0(2) - dp0(1);
p = sig.peaks(s,'Threshold',.2,'Order','Abscissa','Normalize',0);
d = get(p,'PeakPos');
v = get(p,'PeakVal');
dp = d.content{1};
dv = v.content{1};
ddp = diff(dp);
sequ = [];
i = 1;
oldr = [];
while i <= length(ddp)
r = round(ddp(i)/ddp0);
sequ(end+1) = r;
i = i + 1;
oldr = r;
end
figure,plot(sequ,'*')