HannWindow.cs

using System;

using System.Collections.Generic;

using System.Text;

 

namespace FFT

{

    public static class HannWindow

    {

        public static RealFourier GetSpectrum(double[] data)

        {

            double[] w = new double[data.Length];

 

            for (int index = 0; index < data.Length; index++)

            {

                double PI = Math.Acos(-1);

                w[index] = data[index] * (1.0 - Math.Cos(2.0 * PI * index / (data.Length - 1.0))) / 2.0;

            }

 

            return new RealFourier(w);

        }

    }

}