The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Math::CMA - Central Moving Average noise removal

SYNOPSIS

  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)

DESCRIPTION

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.

EXPORTS

The function central_moving_averages on request, none by default.

SEE ALSO

http://en.wikipedia.org/wiki/Moving_average

AUTHOR / COPYRIGHT / LICENSE

  Copyright (c) 2012 Bjoern Hoehrmann <bjoern@hoehrmann.de>.
  This module is licensed under the same terms as Perl itself.