-
Notifications
You must be signed in to change notification settings - Fork 5
/
araivEst.m
64 lines (51 loc) · 1.14 KB
/
araivEst.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
% [ up nd ] = araivEst(f);
%
% this function finds an estimate of arrival times
%
% [INPUT]
% f: the normalized function .
%
% [OUTPUTS]
% up: a structure containing segmented CWT coefficients of main features.
% nd: a structure containing ifo about strong energy arrivals
% -------------------------------------------------------------------------
% By Mostafa Mousavi, smousavi@memphis.edu
% Last modify: Oct 2, 2016
% -------------------------------------------------------------------------
function [ up nd ] = araivEst(f)
% finding beginig of triggers
n = length(f);
out = [];
for i = 2:n-1
if (f(i-1) == 0 & f(i+1)> 0 & f(i) == 0);
out = [out i+1];
end
end
up.all = out;
pick = [out(1)];
for j = 2:length(out);
dis = out(j) - out(j-1);
if dis > 100;
pick = [pick out(j)];
end
end
%
% pick = pick - 100;
up.trig = pick;
% now end of trigger
out = [];
for i = 2:n-1
if (f(i-1) > 0 & f(i+1) == 0 & f(i) == 0);
out = [out i+1];
end
end
nd.all = out;
pick = [out(1)];
for j = 2:length(out);
dis = out(j) - out(j-1);
if (abs(dis)>100);
pick = [pick out(j)];
end
end
% pick = pick + 200;
nd.trig = pick;