-
Notifications
You must be signed in to change notification settings - Fork 10
/
dividet_v2.m
32 lines (30 loc) · 861 Bytes
/
dividet_v2.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
function [newtslist, newtelist] = dividet_v2(t, dtau, tolw)
tslist = t(1:2:end);
telist = t(2:2:end);
%length of each continuous segment
tl = telist - tslist;
newtslist = [];
newtelist = [];
for ti = 1:length(tl)
if tl(ti) >= 30
res = mod(tl(ti), dtau);
quo = (tl(ti) - res) / dtau;
if res <= tolw
ddtau = tl(ti) / quo;
quo1 = quo;
else
ddtau = tl(ti) / (quo + 1);
quo1 = quo + 1;
end
for numquo = 1:quo1
newtslist = [newtslist; tslist(ti) + (numquo - 1) * ddtau];
newtelist = [newtelist; tslist(ti) + numquo * ddtau];
end
elseif tl(ti) >= 10
newtslist = [newtslist; tslist(ti)];
newtelist = [newtelist; telist(ti)];
else
fprintf('This period is even shorter than 10 s, skip\n');
end
end
end