| Bsoft 2.0.5 Bernard's software package

Functions
moving_average.h File Reference

Header file moving average calculations. More...

`#include "Complex.h"`
`#include "matrix_linear.h"`
`#include "utilities.h"`

Go to the source code of this file.

## Functions
double * | moving_average (long number, double *x, long window)
| Calculates a moving average over an array of data. More...
Complex< float > * | moving_average_complex (long number, Complex< float > *x, long window)
| Calculates a moving average over an array of complex data. More...
vector< double > | moving_polynomial (long order, long number, double *x, long window)
| Calculates a moving polynomial fit over an array of data. More...

## Detailed Description

Header file moving average calculations.

Author
  Bernard Heymann

Date
  Created: 20000430
  Modified: 20190225

Definition in file moving_average.h.

## Function Documentation

## ◆ moving_average()

double* moving_average | ( | long | number,
|  | double * | x,
|  | long | window
| ) |  |

Calculates a moving average over an array of data.

Parameters

  number | number of values in the array.
  *x | the array.
  window | sliding window length.

Returns
  double* the moving average array.

      All data points within a sliding window are averaged.
      The window moves over the ends of the array and averages only the
      available points.
      A new array is allocated and the moving averages returned.

Definition at line 28 of file moving_average.cpp.

## ◆ moving_average_complex()

Complex<float>* moving_average_complex | ( | long | number,
|  | Complex< float > * | x,
|  | long | window
| ) |  |

Calculates a moving average over an array of complex data.

Parameters

  number | number of values in the array.
  *x | the array.
  window | sliding window length.

Returns
  Complex<float>* the moving average complex array.

      All data points within a sliding window are averaged.
      The window moves over the ends of the array and averages only the
      available points.
      A new array is allocated and the moving averages returned in it.

Definition at line 75 of file moving_average.cpp.

## ◆ moving_polynomial()

vector<double> moving_polynomial | ( | long | order,
|  | long | number,
|  | double * | x,
|  | long | window
| ) |  |

Calculates a moving polynomial fit over an array of data.

Parameters

  order | polynomial order.
  number | number of values in the array.
  *x | the array.
  window | sliding window length.

Returns
  double* the moving polynomial fit array.

      All data points within a sliding window are fit to a polynomial.
      The window moves over the ends of the array and fits only the
      available points.
      A new array is allocated and the moving polynomial fit values returned.

Definition at line 122 of file moving_average.cpp.