18 lines
738 B
C#
18 lines
738 B
C#
|
|
using System;
|
|||
|
|
|
|||
|
|
namespace FftSharp.Windows
|
|||
|
|
{
|
|||
|
|
public class Hanning : Window, IWindow
|
|||
|
|
{
|
|||
|
|
public override string Name => "Hanning";
|
|||
|
|
public override string Description =>
|
|||
|
|
"The Hanning window has a sinusoidal shape which touches zero at the edges (unlike the similar Hamming window). " +
|
|||
|
|
"It has good frequency resolution, low spectral leakage, and is satisfactory for 95 percent of use cases. " +
|
|||
|
|
"If you do not know the nature of the signal but you want to apply a smoothing window, start with the Hann window.";
|
|||
|
|
|
|||
|
|
protected override double windowValue(int index, int size)
|
|||
|
|
{
|
|||
|
|
return 0.5 - 0.5 * Math.Cos(2 * Math.PI * index / size);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|