tomwalters@0
|
1 % tool
|
tomwalters@0
|
2 %
|
tomwalters@0
|
3 % INPUT VALUES:
|
tomwalters@0
|
4 %
|
tomwalters@0
|
5 % RETURN VALUE:
|
tomwalters@0
|
6 %
|
tomwalters@0
|
7 %
|
bleeck@3
|
8 % (c) 2011, University of Southampton
|
bleeck@3
|
9 % Maintained by Stefan Bleeck (bleeck@gmail.com)
|
bleeck@3
|
10 % download of current version is on the soundsoftware site:
|
bleeck@3
|
11 % http://code.soundsoftware.ac.uk/projects/aimmat
|
bleeck@3
|
12 % documentation and everything is on http://www.acousticscale.org
|
bleeck@3
|
13
|
tomwalters@0
|
14
|
tomwalters@0
|
15 function ret=getmaximacharacteristics(where,maxpos,minpos,maxs,mins)
|
tomwalters@0
|
16 % gibt die wesentlichen Eigenschaften der Maxima zurück:
|
tomwalters@0
|
17 % absoulte_height
|
tomwalters@0
|
18 % position = position of the maximum
|
tomwalters@0
|
19 % distance = mean distance to neighbour mins
|
tomwalters@0
|
20 % contrast = peak to trough ration of max to neighbour mins
|
tomwalters@0
|
21 % supheight = height above the neighbour peaks
|
tomwalters@0
|
22
|
tomwalters@0
|
23 nr=length(where);
|
tomwalters@0
|
24 for i=1:nr
|
tomwalters@0
|
25 [minleft,minleftwo]=getminimumleftof(where(i),maxpos,minpos,maxs,mins);
|
tomwalters@0
|
26 [minright,minrightwo]=getminimumrightof(where(i),maxpos,minpos,maxs,mins);
|
tomwalters@0
|
27 [maxleft,maxleftwo]=getmaximumleftof(where(i),maxpos,minpos,maxs,mins);
|
tomwalters@0
|
28 [maxright,maxrightwo]=getmaximumrightof(where(i),maxpos,minpos,maxs,mins);
|
tomwalters@0
|
29
|
tomwalters@0
|
30 current_val=maxs(find(maxpos==where(i)));
|
tomwalters@0
|
31 ret{i}.absheight=current_val;
|
tomwalters@0
|
32
|
tomwalters@0
|
33 ret{i}.position=where(i);
|
tomwalters@0
|
34
|
tomwalters@0
|
35 ret{i}.contrast=getmaxcontrast(where(i),maxpos,minpos,maxs,mins);
|
tomwalters@0
|
36 ret{i}.width=getmaxwidth(where(i),maxpos,minpos,maxs,mins);
|
tomwalters@0
|
37
|
tomwalters@0
|
38 if ~isempty(minleft) & ~isempty(minright)
|
tomwalters@0
|
39 ret{i}.distance=(abs(minrightwo) - abs(minleftwo))/2; % Mittelwert der Abstände zu den nächsten beiden peaks
|
tomwalters@0
|
40 end
|
tomwalters@0
|
41 if isempty(minleft)
|
tomwalters@0
|
42 ret{i}.distance=abs(minrightwo);
|
tomwalters@0
|
43 end
|
tomwalters@0
|
44 if isempty(minright)
|
tomwalters@0
|
45 ret{i}.distance=abs(minleftwo);
|
tomwalters@0
|
46 end
|
tomwalters@0
|
47
|
tomwalters@0
|
48 if ~isempty(maxleft) & ~isempty(maxright)
|
tomwalters@0
|
49 ret{i}.supheight=current_val/(maxleft+maxright)/2;
|
tomwalters@0
|
50 end
|
tomwalters@0
|
51
|
tomwalters@0
|
52 if isempty(maxleft)
|
tomwalters@0
|
53 if isempty(maxright)
|
tomwalters@0
|
54 ret{i}.supheight=0;
|
tomwalters@0
|
55 else
|
tomwalters@0
|
56 ret{i}.supheight=current_val/maxright;
|
tomwalters@0
|
57 end
|
tomwalters@0
|
58 end
|
tomwalters@0
|
59
|
tomwalters@0
|
60 if isempty(maxleft)
|
tomwalters@0
|
61 if isempty(maxright)
|
tomwalters@0
|
62 ret{i}.supheight=0;
|
tomwalters@0
|
63 else
|
tomwalters@0
|
64 ret{i}.supheight=current_val/maxright;
|
tomwalters@0
|
65 end
|
tomwalters@0
|
66 end
|
tomwalters@0
|
67 end |