Math::CMA - Central Moving Average noise removal
use Math::CMA 'central_moving_averages';
my @averaged = central_moving_averages(2, [1, 2, 3, 4, 5]);
# returns (2, 2.5, 3, 3.5, 4)
The central_moving_averages function takes a smoothing distance and an array reference and returns a list that averages all values in the input over the distance value, in other words, it returns for each value in the input the arithmetic mean of that value plus $distance many values before and $distance many values after it. A practical application would be smoothing time series data.
The function central_moving_averages on request, none by default.
Copyright (c) 2012 Bjoern Hoehrmann <firstname.lastname@example.org>.
This module is licensed under the same terms as Perl itself.
To install Math::CMA, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.