Bsoft  2.1.0
Bernard's software package
moving_average.cpp File Reference

Functions for moving average calculations. More...

#include "moving_average.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...
 

Variables

int verbose
 

Detailed Description

Functions for moving average calculations.

Author
Bernard Heymann
Date
Created: 20000430
Modified: 20190225

Definition in file moving_average.cpp.

Function Documentation

◆ moving_average()

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

Calculates a moving average over an array of data.

Parameters
numbernumber of values in the array.
*xthe array.
windowsliding 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
numbernumber of values in the array.
*xthe array.
windowsliding 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
orderpolynomial order.
numbernumber of values in the array.
*xthe array.
windowsliding 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.

Variable Documentation

◆ verbose

int verbose
extern