Files
DP44/DataPRO/FftSharp/Windows/BlackmanHarris.cs
2026-04-17 14:55:32 -04:00

30 lines
993 B
C#

using System;
namespace FftSharp.Windows
{
public class BlackmanHarris : Window, IWindow
{
private readonly double A = 0.35875;
private readonly double B = 0.48829;
private readonly double C = 0.14128;
private readonly double D = 0.01168;
public override string Name => "Blackman-Harris";
public override string Description =>
"The Blackman-Harris window is similar to Hamming and Hanning windows. " +
"The resulting spectrum has a wide peak, but good side lobe compression.";
public BlackmanHarris() { }
public BlackmanHarris(double a, double b, double c, double d) : this()
{
(A, B, C, D) = (a, b, c, d);
}
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) - D * Math.Cos(6 * Math.PI * index / size);
}
}
}