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: function [m,b]=linearfit(sig) tomwalters@0: % fit the signal with a streight line and return the slope (m) and the zero tomwalters@0: % crossing (b) tomwalters@0: tomwalters@0: y=getvalues(sig); tomwalters@0: x=getxvalues(sig); tomwalters@0: [p,s] = polyfit(x,y,1); tomwalters@0: tomwalters@0: m=p(1); tomwalters@0: b=p(2);