Mercurial > hg > camir-ismir2012
diff toolboxes/bioakustik_tools/math/maxsum.m @ 0:cc4b1211e677 tip
initial commit to HG from
Changeset:
646 (e263d8a21543) added further path and more save "camirversion.m"
author | Daniel Wolff |
---|---|
date | Fri, 19 Aug 2016 13:07:06 +0200 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toolboxes/bioakustik_tools/math/maxsum.m Fri Aug 19 13:07:06 2016 +0200 @@ -0,0 +1,22 @@ +function [startf,stopf,maxsofar]=maxsum(in) + +maxsofar=0; +maxendinghere=0; +startf=1; +stopf=1; +aktstartf=1; + +for i=1:length(in) + if (maxendinghere+in(i) < 0) + maxendinghere=0; + aktstartf=i+1; + else + maxendinghere=maxendinghere+in(i); + end + + if(maxendinghere > maxsofar) + maxsofar=maxendinghere; + stopf=i; + startf=aktstartf; + end +end \ No newline at end of file