Mercurial > hg > camir-aes2014
view toolboxes/bioakustik_tools/math/maxsum.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
line wrap: on
line source
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