kaiserBeta function Null safety

double kaiserBeta(
  1. double a
)

Compute the Kaiser parameter beta, given the attenuation a.

Parameters

  • a : The desired attenuation in the stopband and maximum ripple in the passband, in dB. This should be a positive number.

Returns

  • beta : The beta parameter to be used in the formula for a Kaiser window.

References

  1. Oppenheim, Schafer, "Discrete-Time Signal Processing", p.475-476.

Examples

// Suppose we want to design a lowpass filter, with 65 dB attenuation
// in the stop band.  The Kaiser window parameter to be used in the
// window method is computed by `kaiser_beta(65)`:
print(kaiser_beta(65));
/* output:
6.20426
*/

Implementation

double kaiserBeta(double a) {
  var beta;
  if (a > 50) {
    beta = 0.1102 * (a - 8.7);
  } else if (a > 21) {
    beta = 0.5842 * pow(a - 21, 0.4) + 0.07886 * (a - 21);
  } else {
    beta = 0.0;
  }
  return beta;
}