mathnet / mathnet-numerics

Math.NET Numerics
http://numerics.mathdotnet.com
MIT License
3.48k stars 894 forks source link

Problem with Numerics.Window.FlatTop() #900

Open MartinDGUVIFA opened 2 years ago

MartinDGUVIFA commented 2 years ago

After calling Numerics.Window.FlatTop(x) to get the coefficients of a FlatTop window with x points the maximum value of the coefficients is around 4.64 (instead of around 1). I think there is a Problem with the coefficients used for the calculation (a, b, c, d and e). In Matlab the values of these coefficients are a = 0.21557895, b = -0.41663158, c = 0.277263158, d = -0.083578947 and e = 0.006947368.

cdrnet commented 2 years ago

It turns out there are many different definitions of flat top windows - the one we use seems to be very close to what some Stanford Research spectrum analyzers are using, but rather different to MATLAB. In the past, in such cases we usually implemented multiple variants where you can choose, e.g. for Median statistics, or for FFTs. Looks like we need the same here (and the same also for Nuttall windows)