tomwalters@0: % tool tomwalters@0: % tomwalters@0: % INPUT VALUES: tomwalters@0: % tomwalters@0: % RETURN VALUE: tomwalters@0: % tomwalters@0: % bleeck@3: % (c) 2011, University of Southampton bleeck@3: % Maintained by Stefan Bleeck (bleeck@gmail.com) bleeck@3: % download of current version is on the soundsoftware site: bleeck@3: % http://code.soundsoftware.ac.uk/projects/aimmat bleeck@3: % documentation and everything is on http://www.acousticscale.org tomwalters@0: tomwalters@0: function contrast=getmaxcontrast(wo,maxpos,minpos,maxs,mins) tomwalters@0: % usage: getmaxcontrast(wo,maxs,mins) tomwalters@0: % returns the contrast of the maximum at wo tomwalters@0: % this is calculated by taking the left and the right minimum of the max tomwalters@0: tomwalters@0: [leftminwo,leftmin]=getminimumleftof(wo,maxpos,minpos,maxs,mins); tomwalters@0: if isempty(leftminwo) tomwalters@0: % wenns keinen linkes minimum gibt, versuche, obs ein rechtes gibt tomwalters@0: [rightminwo,rightmin]=getminimumrightof(wo,maxpos,minpos,maxs,mins); tomwalters@0: if ~isempty(rightminwo) tomwalters@0: leftmin=rightmin; tomwalters@0: else tomwalters@0: leftmin=0; tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: [rightminwo,rightmin]=getminimumrightof(wo,maxpos,minpos,maxs,mins); tomwalters@0: if isempty(rightminwo) tomwalters@0: rightmin=leftmin; tomwalters@0: end tomwalters@0: tomwalters@0: maxval=maxs(find(maxpos==wo)); tomwalters@0: tomwalters@0: % Wenn der Punkt kein Maximum der Einhüllenden ist tomwalters@0: if isempty(maxval) tomwalters@0: p=0; tomwalters@0: % error('getmaxcontrast:maximum not in list'); tomwalters@0: end tomwalters@0: tomwalters@0: minval=(rightmin+leftmin)/2; tomwalters@0: tomwalters@0: contrast=(maxval-minval)/(maxval+minval); tomwalters@0: