Subject: | Hamming window incorrect. Also add Blackman. |
Hamming window defined incorrectly.
Instead of (1 - cos(2*$pi*$j/$n))/2;
it should be (0.54 - 0.46*cos(2*$pi*$j/$n)); # see matlab
Also, blackman window should be added.
---------------------
Fixes:
'hamm' => sub {
my ($j, $n) = @_;
my $pi = 4.0*atan2(1,1);
return (0.54 - 0.46*cos(2*$pi*$j/$n));
},
...
'blackman' => sub {
my ($j, $n) = @_;
my $pi = 4.0*atan2(1,1);
return (0.42 - 0.5*cos(2*$pi*$j/$n) + 0.08*cos(4*$pi*$j/$n))/1;
},
---------------------
% perl -v
This is perl, v5.8.8 built for i386-linux-thread-multi
Math::FFT v1.28