init
This commit is contained in:
34
DataPRO/FftSharp/Windows/Tukey.cs
Normal file
34
DataPRO/FftSharp/Windows/Tukey.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
|
||||
namespace FftSharp.Windows
|
||||
{
|
||||
public class Tukey : Window, IWindow
|
||||
{
|
||||
private readonly double Alpha;
|
||||
|
||||
public override string Name => "Tukey";
|
||||
public override string Description =>
|
||||
"A Tukey window has a flat center and tapers at the edges according to a cosine function. " +
|
||||
"The amount of taper is defined by alpha (with low values being less taper). " +
|
||||
"Tukey windows are ideal for analyzing transient data since the amplitude of transient signal " +
|
||||
"in the time domain is less likely to be altered compared to using Hanning or flat top.";
|
||||
|
||||
public Tukey()
|
||||
{
|
||||
Alpha = .5;
|
||||
}
|
||||
|
||||
public Tukey(double alpha = .5)
|
||||
{
|
||||
Alpha = alpha;
|
||||
}
|
||||
protected override double windowValue(int index, int size)
|
||||
{
|
||||
double m = 2 * Math.PI / (Alpha * size);
|
||||
int edgeSizePoints = (int)(size * Alpha / 2);
|
||||
bool isEdge = (index < edgeSizePoints) || (index > size - edgeSizePoints);
|
||||
|
||||
return isEdge ? (1 - Math.Cos(index * m)) / 2 : 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user