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
|
tomwalters@0
|
13
|
tomwalters@0
|
14 function contrast=getmaxcontrast(wo,maxpos,minpos,maxs,mins)
|
tomwalters@0
|
15 % usage: getmaxcontrast(wo,maxs,mins)
|
tomwalters@0
|
16 % returns the contrast of the maximum at wo
|
tomwalters@0
|
17 % this is calculated by taking the left and the right minimum of the max
|
tomwalters@0
|
18
|
tomwalters@0
|
19 [leftminwo,leftmin]=getminimumleftof(wo,maxpos,minpos,maxs,mins);
|
tomwalters@0
|
20 if isempty(leftminwo)
|
tomwalters@0
|
21 % wenns keinen linkes minimum gibt, versuche, obs ein rechtes gibt
|
tomwalters@0
|
22 [rightminwo,rightmin]=getminimumrightof(wo,maxpos,minpos,maxs,mins);
|
tomwalters@0
|
23 if ~isempty(rightminwo)
|
tomwalters@0
|
24 leftmin=rightmin;
|
tomwalters@0
|
25 else
|
tomwalters@0
|
26 leftmin=0;
|
tomwalters@0
|
27 end
|
tomwalters@0
|
28 end
|
tomwalters@0
|
29
|
tomwalters@0
|
30 [rightminwo,rightmin]=getminimumrightof(wo,maxpos,minpos,maxs,mins);
|
tomwalters@0
|
31 if isempty(rightminwo)
|
tomwalters@0
|
32 rightmin=leftmin;
|
tomwalters@0
|
33 end
|
tomwalters@0
|
34
|
tomwalters@0
|
35 maxval=maxs(find(maxpos==wo));
|
tomwalters@0
|
36
|
tomwalters@0
|
37 % Wenn der Punkt kein Maximum der Einhüllenden ist
|
tomwalters@0
|
38 if isempty(maxval)
|
tomwalters@0
|
39 p=0;
|
tomwalters@0
|
40 % error('getmaxcontrast:maximum not in list');
|
tomwalters@0
|
41 end
|
tomwalters@0
|
42
|
tomwalters@0
|
43 minval=(rightmin+leftmin)/2;
|
tomwalters@0
|
44
|
tomwalters@0
|
45 contrast=(maxval-minval)/(maxval+minval);
|
tomwalters@0
|
46
|