-
Notifications
You must be signed in to change notification settings - Fork 0
/
statistic.m
66 lines (62 loc) · 1.85 KB
/
statistic.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
function S = statistic(feature, Start, End, stat, x, win, step, thres)
subFeature = feature(Start:End);
if (nargin>5)
x = x / max(abs(x));
E = ShortTimeEnergy(x, win, step);
T = thres * median(E);
L = min([length(E) length(subFeature)]);
E = E(1:L);
subFeature = subFeature(1:L);
subFeatureNew = subFeature(find(E>T));
subFeature = subFeatureNew;
end
switch stat
case 'maxbymean'
Max = max(subFeature);
Mean = mean(subFeature);
S = Max / Mean;
case 'maxbymedian'
Max = max(subFeature);
Median = median(subFeature);
S = Max / Median;
case 'stdbymean'
Std = std(subFeature);
Mean = mean(subFeature);
S = (Std^2) / (Mean^2);
case 'mean'
S = mean(subFeature);
case 'std'
S = std(subFeature);
case 'max'
S = max(subFeature);
case 'min'
S = min(subFeature);
case 'min1'
temp = sort(subFeature);
S = temp(2);
case 'min2'
temp = sort(subFeature);
S = temp(3);
case 'min3'
temp = sort(subFeature);
S = temp(4);
case 'min4'
temp = sort(subFeature);
S = temp(5);
case 'min0123'
temp = sort(subFeature);
S = mean(temp(1:4));
case 'median'
S = median(subFeature);
case 'a1'
S = length(find(subFeature>mean(subFeature)))/length(subFeature);
case 'a2'
S = length(find(subFeature<0.10*mean(subFeature)))/length(subFeature);
case 'a3'
S = mean(find(subFeature>0.000001));
case 'a4'
S = length(find(subFeature>5.0*mean(subFeature)))/length(subFeature);
case 'zcr1'
S = length(find(subFeature>0.4))/length(subFeature);
end
S(find(isinf(S)))=mean(S(find(~isinf(S))));