setAlpha method

void setAlpha(
  1. double a
)

Set the smoothing factor for exponential averaging

the scaling factor alpha is used to compute exponential moving average of the realtime data using the formula:

$y_n = alpha * x_n + (1 - alpha) * y_{n-1}$

Implementation

void setAlpha(double a) {
  if (a <= 0)
    throw Exception(
        "$HeartBPMDialog: smoothing factor cannot be 0 or negative");
  if (a > 1)
    throw Exception(
        "$HeartBPMDialog: smoothing factor cannot be greater than 1");
  alpha = a;
}