tomwalters@0: % method of class @signal tomwalters@0: % tomwalters@0: % INPUT VALUES: tomwalters@0: % tomwalters@0: % RETURN VALUE: tomwalters@0: % tomwalters@0: % bleeck@3: % This external file is included as part of the 'aim-mat' distribution package 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 [val,height,width,widthvals,base_peak_y]=qvalue2(sig,where) tomwalters@0: % similar to qvalue, but returns the value of height divided by width tomwalters@0: % when height is calculated from maximum to the nearest minimum tomwalters@0: tomwalters@0: tomwalters@0: vals=sig.werte; tomwalters@0: nr_bin=time2bin(sig,where); tomwalters@0: nr_values=getnrpoints(sig); tomwalters@0: tomwalters@0: [maxpos,minpos,maxs,mins]=getminmax(sig); tomwalters@0: tomwalters@0: [pos_min_left,minval_left]=getminimumleftof(where,maxpos,minpos,maxs,mins); tomwalters@0: [pos_min_right,minval_right]=getminimumrightof(where,maxpos,minpos,maxs,mins); tomwalters@0: tomwalters@0: if isempty(pos_min_left) tomwalters@0: pos_min_left=0; tomwalters@0: minimal_left=gettimevalue(sig,pos_min_left); tomwalters@0: end tomwalters@0: if isempty(pos_min_right) tomwalters@0: pos_min_right=getmaximumtime(sig); tomwalters@0: minval_right=gettimevalue(sig,pos_min_right); tomwalters@0: end tomwalters@0: tomwalters@0: if minval_left > minval_right tomwalters@0: new_height=minval_left; tomwalters@0: pos_left=pos_min_left; tomwalters@0: widthvals(1)=pos_left; tomwalters@0: tomwalters@0: pos_right=nr_values+1; tomwalters@0: for i=nr_bin:nr_values tomwalters@0: if vals(i)< minval_left tomwalters@0: pos_right=bin2time(sig,i); tomwalters@0: break; tomwalters@0: end tomwalters@0: end tomwalters@0: else tomwalters@0: new_height=minval_right; tomwalters@0: pos_right=pos_min_right; tomwalters@0: widthvals(2)=bin2time(sig,pos_right); tomwalters@0: tomwalters@0: pos_left=0; tomwalters@0: for i=nr_bin:-1:1 tomwalters@0: if vals(i)< minval_right tomwalters@0: pos_left=bin2time(sig,i); tomwalters@0: break; tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: width=pos_right-pos_left; tomwalters@0: widthvals(1)=pos_left; tomwalters@0: widthvals(2)=pos_right; tomwalters@0: tomwalters@0: height=gettimevalue(sig,where)-new_height; tomwalters@0: tomwalters@0: base_peak_y=new_height; tomwalters@0: tomwalters@0: tomwalters@0: val=height/width; tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: