Mercurial > hg > camir-ismir2012
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:cc4b1211e677 |
---|---|
1 function [startf,stopf,maxsofar]=maxsum(in) | |
2 | |
3 maxsofar=0; | |
4 maxendinghere=0; | |
5 startf=1; | |
6 stopf=1; | |
7 aktstartf=1; | |
8 | |
9 for i=1:length(in) | |
10 if (maxendinghere+in(i) < 0) | |
11 maxendinghere=0; | |
12 aktstartf=i+1; | |
13 else | |
14 maxendinghere=maxendinghere+in(i); | |
15 end | |
16 | |
17 if(maxendinghere > maxsofar) | |
18 maxsofar=maxendinghere; | |
19 stopf=i; | |
20 startf=aktstartf; | |
21 end | |
22 end |