15#include "../Math/Mathematics.h"
26template <
size_t sampleSize>
33 float avg[sampleSize];
34 float std[sampleSize];
45 void GetStdDev(uint8_t start, uint8_t length,
float* data,
float& avgRet,
float& stdRet);
Detects peaks in time-series data using statistical methods.
uint8_t lag
Number of data points to use for moving average and standard deviation.
void GetStdDev(uint8_t start, uint8_t length, float *data, float &avgRet, float &stdRet)
Calculates the mean and standard deviation for a range of data.
void Calculate(float *data, bool *peaks)
Processes the data and identifies peaks.
float avg[sampleSize]
Moving average of the data.
float threshold
Threshold for peak detection, expressed as a multiple of the standard deviation.
float std[sampleSize]
Moving standard deviation of the data.
float influence
Influence of detected peaks on subsequent calculations.
float filData[sampleSize]
Filtered data array for influence adjustment.
PeakDetection(uint8_t lag=12, float threshold=0.75f, float influence=0.5f)
Constructs a PeakDetection object with the specified parameters.