annotate sequences/@seq/integrate.m @ 61:eff6bddf82e3
tip
Finally implemented perceptual brightness thing.
author |
samer |
date |
Sun, 11 Oct 2015 10:20:42 +0100 |
parents |
b1280319413e |
children |
|
rev |
line source |
samer@3
|
1 % integrate - integrate sequence
|
samer@3
|
2 %
|
samer@3
|
3 % integrate ::
|
samer@3
|
4 % seq [[N1,N2]] ~'sequence to integrate',
|
samer@3
|
5 % D:natural ~'dimension to integrate along',
|
samer@3
|
6 % [[M1,M2]] ~'initial value',
|
samer@3
|
7 % ( [[M1,M2]] -> [[M1,M2]]) ~'function to filter initial value each block'
|
samer@3
|
8 % -> seq [[N,M]].
|
samer@3
|
9 %
|
samer@3
|
10 % cumulative sum taken along Dth dimension of the array
|
samer@3
|
11
|
samer@3
|
12 function y=integrate(x,n,a,ff)
|
samer@3
|
13 if nargin<4, ff=@(t)t; end
|
samer@23
|
14 y=cumsum(map(ff,x),a,n);
|
samer@3
|
15 end
|