Skip to content

compute incrmmean

kgryte edited this page May 12, 2015 · 1 revision

Returns a method to compute a moving arithmetic mean incrementally. window sets the window size, i.e., the number of values over which to compute a moving mean.

var data = [ 2, 4, 2, 7, 3 ];

var mmean = compute.incrmmean( 3 ),
	mu;

for ( var i = 0; i < data.length; i++ ) {
	mu = mmean( data[ i ] );
	console.log( mu );
}
console.log( mmean() );
Clone this wiki locally