30 lines
986 B
C#
30 lines
986 B
C#
|
|
using System;
|
|||
|
|
|
|||
|
|
namespace FftSharp.Windows
|
|||
|
|
{
|
|||
|
|
public class Blackman : Window, IWindow
|
|||
|
|
{
|
|||
|
|
private readonly double A = 0.42659071;
|
|||
|
|
private readonly double B = 0.49656062;
|
|||
|
|
private readonly double C = 0.07684867;
|
|||
|
|
|
|||
|
|
public override string Name => "Blackman";
|
|||
|
|
public override string Description =>
|
|||
|
|
"These exact values place zeros at the third and fourth sidelobes, " +
|
|||
|
|
"but result in a discontinuity at the edges and a 6 dB/oct fall-off. " +
|
|||
|
|
"The truncated coefficients do not null the sidelobes as well, but have an improved 18 dB/oct fall-off.";
|
|||
|
|
|
|||
|
|
public Blackman() { }
|
|||
|
|
|
|||
|
|
public Blackman(double a, double b, double c) : this()
|
|||
|
|
{
|
|||
|
|
(A, B, C) = (a, b, c);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected override double windowValue(int index, int size)
|
|||
|
|
{
|
|||
|
|
return A - B * Math.Cos(2 * Math.PI * index / size) + C * Math.Cos(4 * Math.PI * index / size);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|