Examples - pi.science.smoothing.PIMedianSmoothing
1. How to perform simple centered moving average ?
/* - prepare variable for source data */ PIVariable var = new PIVariable(); var.AddValues( new int[] { 37, 45, 39, 48, 47, 57, 52, 49, 56, 59, 62 } ); /* - calc median smoothing, length = 3 */ PIMedianSmoothing medianSmoothing = new PIMedianSmoothing( var ); medianSmoothing.SetWindowLength( 3 ); medianSmoothing.Calc(); /* - show results */ Console.WriteLine( medianSmoothing.GetOutputVariable().AsString( 2 ) );
Output:
37.00;39.00;45.00;47.00;48.00;52.00;52.00;52.00;56.00;59.00;62.00