Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -0,0 +1,10 @@
|
|||
// single-sided
|
||||
Array.prototype.simpleSMA=function(N) {
|
||||
return this.map(function(x,i,v) {
|
||||
if(i<N-1) return NaN;
|
||||
return v.filter(function(x2,i2) { return i2<=i && i2>i-N; }).reduce(function(a,b){ return a+b; })/N;
|
||||
}); };
|
||||
|
||||
g=[1,2,3,4,5,8,5,4];
|
||||
console.log(g.simpleSMA(3))
|
||||
console.log(g.simpleSMA(5))
|
||||
Loading…
Add table
Add a link
Reference in a new issue