-
Notifications
You must be signed in to change notification settings - Fork 0
/
inicio_fin.m
106 lines (67 loc) · 1.49 KB
/
inicio_fin.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
function seg_palabra = inicio_fin(segmentos,ventana, num_segmentos_ruido)
mn = magnitud(segmentos,ventana);
zn = cruces_por_cero (segmentos,ventana) ;
ms = mn(1:10);
zs = zn(1:10);
mmr = mean(ms);
msr = std(ms);
zsmr = mean(zs);
zssr = std(zs);
UmbSupEnrg = 0.5 * max(mn);
UmbInfEnrg = mmr + 2 * msr;
UmbCruCero = zsmr + 2 * zssr;
for i=num_segmentos_ruido+1:length(mn)
if mn(i) > UmbSupEnrg
ln = i;
break
end
end
le = ln;
for i= ln:-1:1
if mn(i) < UmbInfEnrg
le = i;
break
end
end
if (le -25) > 0
fin = le - 25;
else
fin = 11;
end
for i = le:-1:fin
if zn(i) > UmbCruCero
if (zn(i+1) > UmbCruCero) && (zn(i+2) > UmbCruCero)
le = i;
break
end
end
end
%fin palabra
lnf =le;
for i=length(mn)-num_segmentos_ruido-1:-1:le
if mn(i) > UmbSupEnrg
lnf = i;
break
end
end
for i=lnf:length(mn)-num_segmentos_ruido+1
if mn(i) < UmbInfEnrg
lef = i;
break
end
end
if lef +25 < length(mn)-num_segmentos_ruido+1
finf = lef + 25;
else
finf = length(mn)-num_segmentos_ruido+1;
end
for i = lef:finf
if zn(i) > UmbCruCero
if (zn(i+1) && zn(i+2)) > UmbCruCero
lef = i;
break
end
end
end
seg_palabra = segmentos(:,le:lef);
end