Also include big jumps in the calculation for the standard deviation

This commit is contained in:
Michael Zanetti 2021-03-05 22:22:18 +01:00
parent 96ae3cd01a
commit 1b33015354

View File

@ -124,11 +124,11 @@ void StateValueFilterAdaptive::update()
m_outputValueCount++;
}
}
// Poor mans solution to calculate standard deviation. Not as precise, but much faster than looping over history again
m_standardDeviation = ((m_standardDeviation * m_windowSize) + qAbs(changeRatioToAverage)) / (m_windowSize + 1);
}
// Poor mans solution to calculate standard deviation. Not as precise, but much faster than looping over history again
m_standardDeviation = ((m_standardDeviation * m_windowSize) + qAbs(changeRatioToAverage)) / (m_windowSize + 1);
// reset stats on overflow of counters
if (m_inputValueCount < m_outputValueCount) {
m_outputValueCount = 0;